From ddb88b1f69a41333debab20a72c543150e221a46 Mon Sep 17 00:00:00 2001 From: Stefan Date: Thu, 2 Feb 2023 11:20:57 +0000 Subject: [PATCH 1/2] Work in progress and added the new endpoint --- Dockerfile | 2 ++ main.py | 16 ++++++++++---- olx.py | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 4 deletions(-) create mode 100644 olx.py diff --git a/Dockerfile b/Dockerfile index c0d2f36..722ef2e 100755 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,7 @@ ADD requirements.txt /app/ ADD . /app/ RUN apt install chromium -y RUN su -c "apt-get install curl" +RUN su -c "apt-get install python-html5lib" #RUN su -c "apt install chromium -y" RUN su -c "curl -s https://deb.nodesource.com/setup_16.x | bash" RUN su -c "apt install nodejs -y" @@ -13,6 +14,7 @@ RUN su -c "pip3 install git+https://github.com/unixdevil/lighthouse-python.git#e RUN su -c "pip3 install hypercorn" RUN su -c "pip3 install google-search-results" RUN su -c "pip3 install socials" +RUN su -c "pip3 install feedfinder2" RUN su -c "pip3 install pika" RUN su -c "pip3 install pyseoanalyzer" RUN su -c "pip3 install email-validator" diff --git a/main.py b/main.py index c9218bf..c806098 100755 --- a/main.py +++ b/main.py @@ -4,7 +4,7 @@ import socials import datetime as dt from markdownify import markdownify as md - +from feedfinder2 import find_feeds from fastapi import FastAPI, Response from fastapi.middleware.cors import CORSMiddleware from newspaper import Config @@ -53,6 +53,10 @@ "name": "feed-reader", "description": "This will extract the latest entries from a feed", }, + { + "name": "feed-finder", + "description": "This will try to find the feeds associated with a domain", + }, { "name": "article", "description": "This will extract the article from a feed and provide you with some nlp tasks", @@ -140,9 +144,6 @@ async def root(google: GoogleNewsAction): }} -"""Article Extract""" - - @app.post("/feed-reader") async def root(feed: FeedReader): response = feedparser.parse(feed.link) @@ -154,7 +155,14 @@ async def root(feed: FeedReader): }, }} +@app.post("/feed-finder") +async def root(feed: FeedReader): + response = find_feeds(feed.link) + return {"data": { + "feed-link": feed.link, + "response": response, + }} @app.post("/article") async def root(feed: FeedReader): user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) ' \ diff --git a/olx.py b/olx.py new file mode 100644 index 0000000..b316fcb --- /dev/null +++ b/olx.py @@ -0,0 +1,62 @@ +''' +By: Donald Lee +Date: August 10th-13th, 2020 + +For instructions or information, please refer to https://github.com/Donald-K-Lee/InstagramDMBot/blob/master/README.md + +Please do NOT use this for spam, bullying, etc. +By using this script, YOU will take FULL responsibility for anything that happens to ANYONE you use this on and anything you do with this script!. +Additionally, using this script may involve a risk of you being banned and even other risks including but not limited to: being hacked, etc. +Use this script at your own risk! +''' + +from selenium import webdriver +# To wait for side load +from selenium.webdriver.common.by import By +from selenium.webdriver.support.ui import WebDriverWait +from selenium.webdriver import ActionChains + +from selenium.webdriver.support import expected_conditions as EC + +# Allows us to use keyboard keys +from selenium.webdriver.common.keys import Keys +import time + +username = "nomaxvalue" # Enter in your email for Instagram inside the quotation marks +mypassword = "garcelino87#" # Enter in your password for Instagram inside the quotation marks +friendusernames = ["alina_kiss_aa"] # Enter in the username of the recipient inside the quotation marks! To send this to mutiple users, seperate users by commas! Ex) friendusernames = ["@friend1", "@friend2", "@friend3"] +numoftimes = "1" # Enter in the number of times you would like to send the message to the recipient Ex) "2" + +# The message being sent +message = "" + +PATH = "/usr/bin/chromedriver" # Step 4 of the installations instructions + +driver = webdriver.Chrome(PATH) + +url = "https://www.olx.ro/d/oferta/transport-persoane-germania-la-adresa-IDeFjlS.html" +driver.get(url) + +try: + #/html/body/div[3]/div[3]/div/div[1]/div/div[2]/div/button[1] + + try: + dmbtn = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, '/html/body/div[3]/div[3]/div/div[1]/div/div[2]/div/button[1]'))) + dmbtn.click() + except: + print ("Could not find accept cookies button") + try: + dmbtn = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, '/html/body/div[2]/div[1]/div[3]/div[3]/div[2]/div[1]/div[3]/div/button[1]'))) + dmbtn.click() + time.sleep(15) + dmbtn.until(EC.element_to_be_clickable(By.XPATH,'/html/body/div[2]/div[1]/div[3]/div[3]/div[2]/div[1]/div[3]/div/button[1]/span/a')) + print(dmbtn.getText()) + + except: + print ("Could not find call button") + + +except: + print("An error has occurred") + time.sleep(1) + driver.quit() \ No newline at end of file From f837227684414e131f031f2b2ab908cfe8f06ba1 Mon Sep 17 00:00:00 2001 From: Stefan Date: Thu, 2 Feb 2023 11:26:01 +0000 Subject: [PATCH 2/2] fixed the docker file --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 722ef2e..a6f6ec4 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,17 @@ FROM python:3.10 RUN apt update +RUN apt install curl WORKDIR /app/ ADD requirements.txt /app/ ADD . /app/ RUN apt install chromium -y -RUN su -c "apt-get install curl" -RUN su -c "apt-get install python-html5lib" + #RUN su -c "apt install chromium -y" RUN su -c "curl -s https://deb.nodesource.com/setup_16.x | bash" RUN su -c "apt install nodejs -y" RUN su -c "npm install -g lighthouse" RUN su -c "pip3 install git+https://github.com/unixdevil/lighthouse-python.git#egg=lighthouse" +RUN su -c "pip3 install html5lib" RUN su -c "pip3 install hypercorn" RUN su -c "pip3 install google-search-results" RUN su -c "pip3 install socials"