wikiHowUnofficialAPI
version 0.1.1
Wikihowunofficilapi มีจุดมุ่งหมายเพื่อให้อินเทอร์เฟซที่ใช้งูเหลือมเพื่อแยกข้อมูลที่เป็นประโยชน์จากบทความ WikiHow เช่นบทสรุปบทความขั้นตอนรูปภาพ ฯลฯ ในวิธีที่ง่ายต่อการใช้งาน
pip install wikiHowUnofficialAPIเรียนรู้สิ่งที่สุ่ม! retuns url บทความ wikihow แบบสุ่ม
import wikihowunofficialapi as wha
ra = wha . random_article ()
print ( ra )ใช้ URL บทความเพื่อส่งคืนรายละเอียดต่าง ๆ เกี่ยวกับบทความ นอกจากนี้ยังส่งคืนไม่ว่าจะเป็นบทความที่เขียนโดยผู้เชี่ยวชาญหรือไม่
import wikihowunofficialapi as wha
article = wha . Article ( 'https://www.wikihow.com/Train-a-Dog' )
print ( article . url ) # Print Article's URL
print ( article . title ) # Print Article's Title
print ( article . intro ) # Print Article's Introduction
print ( article . n_methods ) # Print number of methods in an Article
print ( article . methods ) # Print a list of methods in an Article
print ( article . num_votes ) # Print number of votes given to an Article
print ( article . percent_helpful ) # Print percentage of helpful votes given to an Article
print ( article . is_expert ) # Print True if the Article is written by an expert
print ( article . last_updated ) # Print date when the Article was last updated
print ( article . views ) # Print the number of views recieved by Article
print ( article . co_authors ) # Print the number of co-authors of an Article
print ( article . references ) # Print the number of references in an Article
print ( article . summary ) # Print Article's summary
print ( article . warnings ) # Print Article's warnings
print ( article . tips ) # Print Article's tips
first_method = article . methods [ 0 ]
first_step = first_method . steps [ 0 ]
print ( first_step ) # Print Article's first step of the first method
print ( first_step . title ) # Print the title of Article's first step of the first method
print ( first_step . description ) # Print the description of Article's first step of the first methodดึงรายการรูปภาพที่รวมอยู่ในขั้นตอนเป็น URL
import wikihowunofficialapi as wha
article = wha . Article ( 'https://www.wikihow.com/Train-a-Dog' )
print ( article . methods [ 0 ]. steps [ 0 ]. picture ) # Print the URL of the image of Article's first step of the first methodค้นหา WikiHow สำหรับสตริงและส่งคืนรายการที่มีชื่อเรื่องของบทความ ผลลัพธ์สูงสุดเริ่มต้นคือ 10 แต่สามารถเปลี่ยนแปลงได้
import wikihowunofficialapi as wha
max_results = 1
how_tos = wha . search_wikihow ( "sleep" , max_results )
print ( how_tos [ 0 ])