Merhaba ;
Yurt içi sitesinden requests ile aldığım veri ****** olarak dönüyor bu veriyi nasıl düzgün bir şekilde çekebilirim
# -*- coding : utf-8 -*-
from openpyxl import load_workbook
from parsel import Selector
import re , requests ,json
birles1="https://www.yurticikargo.com/tr/online-servisler/gonderi-sorgula?code=100777732496"
target_url=birles1
print(birles1)
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36'
}
response = requests.get(target_url, headers=headers)
if response.status_code == 200:
selector = Selector(response.text)
REGEX = re.compile('<.*?>|&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-f]{1,6});')
isim = selector.xpath('/html/body/div[3]/div[1]/section[2]/div/div[2]/div/div[1]/div[1]/div/div/div[4]/div[1]/div[2]/span').get()
print(REGEX.sub('', isim).strip())
else:
print('yurtiçi Bağlantı kurulamadı! HTTP Kodu: ', response.status_code)