G
G
Guerro692020-06-01 13:38:02
Python
Guerro69, 2020-06-01 13:38:02

When parsing a site, the site requires JavaScript to be enabled, what should I do?

wrote a simple code with which I log in to the game forum and when I display text, I get "Please turn JavaScript on and reload the page."
The code:

import requests
import numpy as np
import pandas as pd
import time
from fake_useragent import UserAgent

data = {
  "login": "Здесь был мой логин",
  "register": "0",
  "password": "Здесь был мой пароль",
  "remember": "1",
  "cookie_check": "1",
  "redirect": "/threads/rm-r%D0%A0-%D0%98%D0%B3%D1%80%D0%B0-%D0%A1%D1%87%D0%B8%D1%82%D0%B0%D0%B5%D0%BC-%D0%B4%D0%BE-10000.334257/page-112",
  "_xfToken": ""
}
page_link = 'https://forum.r-rp.ru/login/login'
r = requests.get(page_link, headers={'User-Agent': UserAgent().chrome}, data=data)
print(r)
print(r.text)

outputs the following to the console:
'''
Response [200]
!DOCTYPE html
html
script src="/vddosw3data.js"/script
body
div w3-include-html="/5s.html"/div
noscripth1 style="text-align :center;color:red;"strongPlease turn JavaScript on and reload the page./strong/h1/noscript
script
w3IncludeHTML();
/script
script language="javascript"document.cookie="R3ACTLB=0e86deeb66e8cce0c97cae6a3fdf65d6 ; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/";setTimeout("location.href=' https:// forum.r-rp.ru:443/threads/rm-r%D0%A0-%D0%9... ';",5000);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Saboteur, 2020-06-01
@saboteur_kiev

Well it is written - to include dzhava a script. You can enable, debug and parse a specific query.
To parse a site, it is desirable to understand how modern web technologies work, how dynamic pages are generated, what are headers, and what is an API

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question