This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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 | |
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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") | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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") | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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 | |
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | for i in range(10): | |
| print(i) | 
NewerOlder