wikiHowUnofficialAPI
version 0.1.1
Wikihounofficilapi는 기사 요약, 단계, 이미지 등과 같은 Wikihow 기사에서 사용하기 쉬운 방식으로 유용한 정보를 추출하기위한 파이썬 기반 인터페이스를 제공하는 것을 목표로합니다.
pip install wikiHowUnofficialAPI임의의 물건을 배우십시오! 임의의 Wikihow 기사 URL을 재조정합니다.
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 ])