-
Notifications
You must be signed in to change notification settings - Fork 3
/
football_matches.py
36 lines (32 loc) · 926 Bytes
/
football_matches.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# pip install requests
# pip install bs4
import sqlite3
conn = sqlite3.connect("some_data.db")
cur = conn.cursor()
sql = """CREATE TABLE titles(title TEXT);"""
cur.execute(sql)
conn.commit()
# import requests
# from bs4 import BeautifulSoup
# HEADERS = {
# "User Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
# }
# url = "https://qalampir.uz/"
# page = requests.get(url, headers=HEADERS)
# # print(page.status_code)
# soup = BeautifulSoup(page.text, "html.parser")
# matches = [match for match in soup.findAll("div", class_="news-card")]
# news = []
# for i in matches:
# i = i.find("a", class_="news-card-content-text")
# print(type(i.text))
# print(url + i["href"])
# news.append(
# {
# "title":i.text,
# "url":url + i["href"]
# }
# )
# print(news)
# for x in news:
# print(x)