Skip to content

Instantly share code, notes, and snippets.

View bilative's full-sized avatar
🙂

Bilal Latif Ozdemir bilative

🙂
View GitHub Profile
@bilative
bilative / detay_url_deneme.py
Last active January 28, 2023 21:32
detay_url_deneme.py
import requests #!pip install requests
from bs4 import BeautifulSoup #!pip install beautifulsoup4
import pandas as pd
import time
def get_soup(TARGET_URL):
page = requests.get(TARGET_URL)
soup = BeautifulSoup(page.text, 'html.parser')
return soup
import requests #!pip install requests
from bs4 import BeautifulSoup #!pip install beautifulsoup4
import time
from libs.helpies import sendTweet
URLs = 'https://sisterslab.co/blog/'
def get_soup(TARGET_URL):
page = requests.get(TARGET_URL)
soup = BeautifulSoup(page.content, 'html.parser', from_encoding="utf-8")
while (True):
html_icerigi = # get_soup ile blog duyuru sayfası html içeriğine ulaş
yeni_blog_urlleri = # html içeriğinden blog urllerini filtrele ve bir listeye kaydet
yeni_blog_fotolari = # html içeriğinden blog kapak fotoğraflarını filtrele ve bir listeye kaydet
yeni_blog_cumleleri = # html içeriğinden blog giriş cümlelerini filtrele ve bir listeye kaydet
# Yeni blog listesi ile önceki gün oluşan listeyi karşılaştır
if (yeni_blog_urlleri != eski_blog_urlleri): # Eğer 2 liste eşit değilse bu yeni blog yazısı eklendiğine işarettir
for icerik in yeni_blog_urlleri: # Yeni listede for döngüsü ile gez
if icerik not in eski_blog_urlleri: # Bir blog yazısı dün oluşan listede bulunuyorsa bu yeni bir yazı değildir. Aksi durumda yeni bir yazıdır
import tweepy
# Kimlik doğrulaması için developer hesabınızın consumer keys ve access tokens bilgileri gerekli
consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
import requests #!pip install requests
from bs4 import BeautifulSoup #!pip install beautifulsoup4
import pandas as pd
import time
URL = 'https://sisterslab.co/blog/'
def get_soup(TARGET_URL):
page = requests.get(TARGET_URL)
soup = BeautifulSoup(page.content, 'html.parser', from_encoding="utf-8")
for i in product_urls:
product_soup = get_soup(i)
time.sleep(0.3)
product_data = []
for i in product_soup.find_all('td'):
product_data.append(clean_scraped(i.text))
df.loc[len(df)] = product_data
df
sogan_url = 'https://bilative.github.io/sisterslab/urun/sogan'
sogan_soup = get_soup(sogan_url)
col_names = []
for i in sogan_soup.find_all('th'):
col_names.append(clean_scraped(i.text))
print(clean_scraped(i.text))
#UrunAdi
product_urls = []
for i in page_urls:
page_soup = get_soup(i)
for j in page_soup.find_all("a", attrs={'class':'urun-adi'}):
product_urls.append(j["href"])
print(j["href"])
#https://bilative.github.io/sisterslab/urun/ananas
#https://bilative.github.io/sisterslab/urun/armut
#https://bilative.github.io/sisterslab/urun/avakado
import requests #!pip install requests
from bs4 import BeautifulSoup #!pip install beautifulsoup4
import pandas as pd
def get_soup(TARGET_URL):
page = requests.get(TARGET_URL)
soup = BeautifulSoup(page.text, 'html.parser')
return soup
for i in range(10):
print(i)