利用python提取电影天堂电影信息下载地址
1、思路
1。提取到主页面中的每一个电影的背后的那个url地址
1。1。拿到2022必看热片那一块的HTML代码
1。2。从刚才拿到的HTML代码中提取到href的值
2。访问子页面,提取到电影的名称以及下载地址2、完整代码importrequestsimportreurlhttps:www。dy2018。comresprequests。get(url)resp。encodinggbkprint(resp。text)1。提取2022必看热片部分的HTML代码obj1re。compile(r2022必看热片。?ul(?Phtml。?)ul,re。S)result1obj1。search(resp。text)htmlresult1。group(html)2。提取a标签中的href的值obj2re。compile(rli。?)title)result2obj2。finditer(html)3。提取到电影的名称以及下载地址obj3re。compile(r。?片名。?(?Pmovie。?)br。?tdstyleWORDWRAP:breakwordrbgcolorfdfddf。?),re。S)foriteminresult2:print(item。group(href))拼接出子页面的urlchildurlurl。strip()item。group(href)childresprequests。get(childurl)childresp。encodinggbkresult3obj3。search(childresp。text)movieresult3。group(movie)downloadresult3。group(download)print(movie,download)3、获取的电影下载地址