Home > other >  Small white python creeper, seek help
Small white python creeper, seek help

Time:11-20

Why the result is None ~, ask for help ~

 
The import requests
The from bs4 import BeautifulSoup
Headers={
'Accept' : 'application/json, text/plain, */*',
'the Accept - Encoding' : 'gzip, deflate, br',
'the Accept - Language' : 'useful - CN, useful; Q=0.9 ',
'Connection' : 'keep - the alive',
'cookies' :' DEVICE_ID=1597277947293599669387265; D9a gr_user_id c03=1 b21fbe6-1-4 - a3d1e6d7c a924-835; Ac641e22637cd956_gr_last_sent_cs1=undefined; __secdyid=d7a86ea66fcaa4cd6ad69b9ab40e62f36764419b37d985d5021597277947; Ebbdd43 - a43e grwng_uid=0-429 - d - afd6 c334debeda6 0; Acw_tc=76 b20fef15977077971756612e37a995a65eb44444b84cc7e26a5d8064351a; Co=mzmovie; Ac641e22637cd956_gr_session_id=6269 cefa 40 c2-8-9 ba5 - f70 - de7833d85f8a; Ac641e22637cd956_gr_last_sent_sid_with_cs1=6269 cefa 40 c2-8-9 ba5 - f70 - de7833d85f8a; Ac641e22637cd956_gr_cs1=undefined; Ac641e22637cd956_gr_session_id_6269cefa 40 c2-8-9 ba5 - f70 - de7833d85f8a=true; COOKIE_CITY_ID=110100; E5 COOKIE_CITY_NAME=% % 8 c % 97% BA E4 % % AC; COOKIE_BUSINESS_CITY=110100; COOKIE_SERVICE_TIME=1597707858 ',
'Host' : 'm.maizuo.com',
'Referer' : 'https://m.maizuo.com/v5/? Co=mzmovie ',
'the Sec - Fetch - Dest' : 'empty'
'the Sec - Fetch - Mode:' cors,
'the Sec - Fetch - Site' : 'the same - origin,
'the user-agent' : '# DingXin DX_2. 3.0.42076/5.0 (Windows; U; Windows NT 6.1; En - US; The rv: 1.9.1.7) Gecko YHZ_Client_Test/2.3.0.42076 ',
'X - the Client - Info' : '{" a ":" 3000 ", "ch" : "1002", "v" : "5.0.4", "e" : "1597277947293599669387265", "BC" : "110100"}',
'X - Host' : 'mall. The film - ticket. Film. List',
'X - Requested - With' : 'the XMLHttpRequest,
'X - Token' : 'undefined,
}
Res=requests. Get (' https://m.maizuo.com/v5/#/films/nowPlaying 'headers=headers)
Bs=BeautifulSoup (res) text, '. The HTML parser)
Movie_babai=bs. Find (class_="nowPlayingFilm - item")
Print (movie_babai)



Why the result is None ~, ask for help

CodePudding user response:

Can you not sent it, all say your url is wrong, here is the url asynchronous loading, also known as content after click on the web page content is loaded with CSS, not static, so can't get, need from the console analyze the real urls

CodePudding user response:

Code is this, haven't delete
 
#! The/usr/bin/env python
# - * - coding: utf-8 - * -
The import requests
The import json

Urls_1='https://m.maizuo.com/gateway? CityId=440300 & amp; PageNum=1 & amp; PageSize=10 & amp; Type=1 & amp; K=7899773 '
Urls_2='https://m.maizuo.com/gateway? CityId=440300 & amp; PageNum=2 & amp; PageSize=10 & amp; Type=1 & amp; K=1925194 '
Urls_3='https://m.maizuo.com/gateway? CityId=440300 & amp; PageNum=3 & amp; PageSize=10 & amp; Type=1 & amp; K=7338125 '
Urls_4='https://m.maizuo.com/gateway? CityId=440300 & amp; PageNum=4 & amp; PageSize=10 & amp; Type=1 & amp; K=979749 '
Urls_5='https://m.maizuo.com/gateway? CityId=440300 & amp; PageNum=5 & amp; PageSize=10 & amp; Type=1 & amp; K=3650839 '
Urls=[urls_1, urls_2 urls_3, urls_4, urls_5]
Headers={
'the user-agent' : 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10 _12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36 ',
'X - the Client - Info' : '{" a ":" 3000 ", "ch" : "1002", "v" : "5.0.4", "e" : "1597373545337880782209026", "BC" : "421100"}',
'X - Host' : 'mall. The film - ticket. Film. List',
'X - Requested - With' : 'the XMLHttpRequest,
'X - Token' : 'undefined'
}
For the url in urls:
The response=requests. Get (url=url, headers=headers)
HTML=response. Content. decode (" utf-8 ")
Page=json. Loads (HTML) (" data "] [" control-insistent pang "]
For the data in page:
Film_name=data/" name ", "
If "actors" in data:
A=list ()
For d in data (" actors ") :
Film_actor=d/" name "+" - "+ d (" role")
A.a ppend (film_actor)
Film_info=data [" synopsis "]
Print (" movie name: {}, {}, introduction: {} ". The format (, a, film_name film_info))
The else:
Film_actor=data (" director ")
Print (" movie name: {}, {}, introduction: {} ". The format (film_name film_actor, film_info))

CodePudding user response:


The crawler is mainly analysis which is real urls

CodePudding user response:

Oh, I see, principle did not understand before,

CodePudding user response:

The
reference 4 floor Iphone60PLus reply:
oh, I see, before did not understand,

Two posts will not stick is equal to play the gadfly
  • Related