程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Python crawler, whats the problem when you encounter this kind of problem? Is there any explanation for your tears

編輯:Python

The running results are as follows , And then I used jupyter
C:\ProgramData\Anaconda3\lib\site-packages\urllib3\connectionpool.py:979: InsecureRequestWarning: Unverified HTTPS request is being made to host 'www.dytt89.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
warnings.warn(
[]

import requestsimport reimport csvhomepage = "https://www.dytt89.com/"url1 = requests.get(homepage,verify=False)url1.encoding='gbk'obj1= re.compile("2022 Must see hot film .*?<li><a href='(?P<url2>.*?).*?</ul>",re.S)obj2= re.compile("href='/(?P<url22>.*?)' title=",re.S)obj3= re.compile("◎ slice name (?P<name>.*?)<br />,re.S")res1 = obj1.finditer(url1.text)res2 = obj2.finditer(str(res1))final = []for i in res2: url2 = requests.get(homepage + i,verify=False) url2.encoding='gbk' final.append(obj3.search(url2))print(final)




Take the answer :

Be violent :

import urllib3

urllib3.disable_warnings()



  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved