Merhaba, Nöbetçi eczane script'i arıyorum. Önceliğim ücretsiz olmasıdır.
Teşekkür ederim
Nöbetçi eczane scripti.
5
●368
- 08-07-2022, 00:45:14Aynen nöbetçi eczaneleri toplayan normal sıradan bir nöbetçi eczane script'i.Castaway adlı üyeden alıntı: mesajı görüntüle
- 08-07-2022, 00:46:35Seneler öncesi, amatörken yapmıştım. Çalışır mı şu anda bilmiyorum. Python. Dene, çalışacağını düşünüyorum.
Edit: şöyle bir üzerinden kabaca baktım. Düzenleme gerektiriyor.
import mysql.connector
import requests
from selenium import webdriver
from datetime import date
from datetime import datetime
from selenium.common.exceptions import NoSuchElementException
import time
from selenium.common.exceptions import NoSuchElementException
import random
import time
import re
import json
from selenium.webdriver.chrome.options import Options
class BorsaCrawler:
def __init__(self, driver_path='/Users/xxx/Documents/PythonProjects/chromedriver'):
self.chrome_options = Options()
#self.chrome_options.add_argument("--no-sandbox")
#self.chrome_options.add_argument("--headless")
#self.chrome_options.add_argument("window-size=1024,768")
#prefs = {"profile.managed_default_content_settings.images" : 2}
#self.chrome_options.add_experimental_option("pref s", prefs)
self.chrome_options.add_experimental_option("exclu deSwitches", ["enable-automation"])
self.chrome_options.add_experimental_option('useAu tomationExtension', False)
self.chrome_options.add_argument("--disable-blink-features=AutomationControlled")
self.driver_path = driver_path
self.driver = webdriver.Chrome(options=self.chrome_options, executable_path=self.driver_path)
self.mydb = mysql.connector.connect(
host="xxx",
user="xxx",
password="xxx",
database="xxx",
#port=8889
)
self.mycursor = self.mydb.cursor()
def crawl(self):
driver = self.driver
url = 'xxx' #Özel mesaj ile verebilirim url yi.
driver.get(url);
input('Devam ? : ')
while True:
response = requests.get("http://localhost:8888/eczaneler/bot/nobetciler.php?islem=guncelle")
meta_data = response.text.replace("\", "").replace("'", """)
meta_data = json.loads(meta_data)
url = meta_data['url']
print("-------------------------")
try:
il = (meta_data['il']);
print("Bakılan İl : " + str(il))
except:
0
print("-------------------------")
if meta_data['il'] == '-1':
print("Başka veri kalmadı bitir.")
break
url = 'xxx/nobetci-'+str(url)
driver.get(url);
y = 1
x = 0
try:
while True:
if il =='İstanbul' :eczaneler
eczane_adi = driver.find_element_by_xpath('//*[@id="nav-bugun"]/table/tbody/tr['+str
+']/td/div/div[1]/span[1]').text
else:
eczane_adi = driver.find_element_by_xpath('//*[@id="nav-bugun"]/table/tbody/tr['+str
+']/td/div/div[1]/a/span').text
eczane_adi = eczane_adi.replace("'", " ")
eczane_adresi = driver.find_element_by_xpath('//*[@id="nav-bugun"]/table/tbody/tr['+str
+']/td/div/div[2]').text
eczane_adresi = eczane_adresi.split('(')[0]
eczane_adresi = eczane_adresi.split('n')[0]
eczane_adresi = eczane_adresi.split('r')[0]
eczane_adresi = eczane_adresi.replace("'", " ")
try:
eczane_adres_tarifi = driver.find_element_by_xpath('//*[@id="nav-bugun"]/table/tbody/tr['+str
+']/td/div/div[2]/span[@class="text-secondary font-italic"]').text
eczane_adres_tarifi = eczane_adres_tarifi.replace("'", " ")
except:
eczane_adres_tarifi = 'NaN'
try:
eczane_semt = driver.find_element_by_xpath('//*[@id="nav-bugun"]/table/tbody/tr['+str
+']/td/div/div[2]/div/span[2]').text
except:
eczane_semt = 'NaN'
eczane_ilce = driver.find_element_by_xpath('//*[@id="nav-bugun"]/table/tbody/tr['+str
+']/td/div/div[2]/div/span[1]').text
eczane_tel = driver.find_element_by_xpath('//*[@id="nav-bugun"]/table/tbody/tr['+str
+']/td/div/div[3]').text
eczane_adresi = eczane_adresi.replace(str(eczane_ilce+eczane_semt) , "")
try:
eczane_not = driver.find_element_by_xpath('//*[@id="nav-bugun"]/table/tbody/tr['+str
+']/td/div/div[2]/span[@class="font-weight-bold text-success"]').text
eczane_not = eczane_not.replace("'", " ")
except:
eczane_not = 'NaN'
self.sql = "insert into nobetciler (eczane_adi, adresi, adres_tarifi, notlar, iletisim_no, semt, il, ilce, nobet_tarihi) "
"values ('"+str(eczane_adi)+"','"+str(eczane_adresi)+"', '"+str(eczane_adres_tarifi)+"', '"+str(eczane_not)+"', '"+str(eczane_tel)+"', '"+str(eczane_semt)+"', '"+str(il)+"', '"+str(eczane_ilce)+"', '"+str(meta_data['bugun'])+"')"
self.mycursor.execute(self.sql)
# driver.quit()
self.mydb.commit()
print(str(il))
print(str(eczane_adi))
print(str("-----------"))
y = y + 1
except:
print("Atlandı")
x = x + 1
if x > 10:
break
def main():
sc = BorsaCrawler()
sc.crawl()
if __name__ == '__main__':
main() - 09-07-2022, 12:38:02Cloudflare kullanıyor o site. 10-15.ilde patlaması ihtimal dahilinde. En iyisi ücretiyle bir api satın almak. İstikrarlı ve dönüp arkana bakmamak açısından.Castaway adlı üyeden alıntı: mesajı görüntüle