페이지를 요청할 때마다 json 형식으로 JavaScript로 가져옵니다. 이렇게하면 "https://www.kaggle.com/kernels.json?sortBy=hotness&group=everyone&pageSize=20&after=439354&language=all&outputType=all"에서 가져올 수 있습니다.
import requests
import json
source = requests.get("https://www.kaggle.com/kernels.json?sortBy=hotness&group=everyone&pageSize=20&after=439354&language=all&outputType=all")
json_obj = source.json()
for a in json_obj:
print (a["title"])
출력 :
2004-2005 Landfalling Hurricanes animation
Visualization of StockData
Generating Sentences One Letter at a Time
Decoding the Sexiest Job of 21st Century!!
Novice to Grandmaster
Analysis on Pokemon Data
ROC Curve with k-Fold CV
Japan Bulgaria trade playground
Bootstrapping and CIs with Veteran Suicides
Replicating "Did I do that?" paper analyses with R
Social Progress Index and World Happiness Report
SVM+HOG On ColourCompositeImage
Low- level students
PyTorch Speech Recognition Challenge (WIP)
Loans -getting Insights
Exploring Youtube Trending Statistics EDA
3 Simple Steps (LB: .9878 with new data)
Titanic: Neural Network using Keras
Feature Engineering
Why do employees leave and what to do about it
쿼리 문자열 매개 변수 "후"내 요청에 439,354이었다 그러나 첫 번째 기록을 얻기 위해 0으로 설정할 수 변경해야 할 유일한 것은이다 .
"pageSize"쿼리 문자열 매개 변수를 변경하여 반환되는 레코드의 양을 변경할 수도 있습니다. "https://www.kaggle.com/kernels.json?sortBy=hotness&group=everyone&pageSize=5&after=0&language=all&outputType=all"
출력 :
Data ScienceTutorial for Beginners
Data visualization and investigation
Spooky NLP and Topic Modelling tutorial
20 Years Of Games Analysis
NYC Taxi EDA - Update: The fast & the curious
또는 URLLIB와 예 :
import urllib.request
import json
kaggle = "https://www.kaggle.com/kernels.json?sortBy=hotness&group=everyone&pageSize=5&after=0&language=all&outputType=all"
data = urllib.request.urlopen(kaggle).read()
json_obj = json.loads(data.decode("utf-8"))
for a in json_obj:
print (a["title"])
이 정적 콘텐츠 분석을 위해 사용되는 HTML 콘텐츠 URLLIB하지 얻기위한 시간 지연 및 사용 요청 라이브러리를 제공 , 귀하의 사례가 동적 콘텐츠입니다. –
[HTML 데이터가 urllib에 숨겨져 있습니다] 가능한 복제본 (https://stackoverflow.com/questions/47351045/html-data-is-hidden-from-urllib) –