I have one site trying to scarp it using requests_html
but it only take Arabic language I need the English text of the title Etc..
import pandas
from requests_html import HTMLSession
import time
import requests
from requests import get
from requests_html import HTMLSession
import re
url = 'https://pcpalace.com.sa/products/ASUS-Vivobook-GO-E1504GA'
headers = {"Accept-Language": "en"}
session = HTMLSession()
r = requests.get(url, headers=headers)
r.raise_for_status()
#name
makestr=str(r.text)
name=makestr.splitlines()[50]
print(name)
I tried using
headers = {"Accept-Language": "en"}
but that was not working either
The Accept-Language header is only used to inform the server about the preferred language of the response. It doesn't guarantee that the server will respond in the specified language, but only if available.
You can try translating the specific text you want by using the Google Translate python library. Here's an example on how to translate the title element of the response:
Install Google Translate 4 using pip:
4.0.0rc1 is a prerelease version, if for some reason it doesn't work try using the 3.0 version: