IQIYI rastreo de búsqueda caliente

sitio # Amor Arte Fantástico Web: http: //v.iqiyi.com/index/resou/index.html

Las solicitudes de importación
de la BeautifulSoup BS4 Importación
Importación PANDAS como Pd
URL = 'http: //v.iqiyi.com/index/resou/index.html'# buscar URL
cabeceras = {' User-Agent: Mozilla / 5.0 (Windows NT 10,0; Win64; 64) AppleWebKit / 537.36 ( KHTML, like Gecko) Chrome / 70.0.3538.102 Safari / 537.36 Edge / 18.18363 '} # camuflaje oruga
r = requests.get (url) # get solicitud transmitida
r.encoding = r.apparent_encoding # unificó que codifica
sopa = BeautifulSoup (R.TEXT, 'lxml ') # sOPA objetos
a = [] # crear tablas
B = []
para Y en soup.find_all (clase _ = "título - Box 1."):
a.append (Y .get_text () Gaza ()).
para X en soup.find_all (clase _ = -) "título del cuadro 3.":
. b.append (x.get_text () Gaza ())
datos = [título, índice]
impresión ( Data)
C = pd.DataFrame (Data, índice = [ "título", "calor"]) # Visualizado
impresión (CT)

 

Obtiene el título de calor

 

los resultados

 

Supongo que te gusta

Origin www.cnblogs.com/cwddbky/p/12526989.html
Recomendado
Clasificación