Demo / scraper.py
shivam-kala's picture
trying
3c4b522
# from selenium import webdriver
# from selenium.webdriver.common.by import By
from flask import Flask,request
import requests
app = Flask(__name__)
# chrome_options = webdriver.ChromeOptions() # Create object ChromeOptions()
# chrome_options.add_argument('--headless')
# chrome_options.add_argument('--no-sandbox')
# chrome_options.add_argument('--disable-dev-shm-usage')
# chrome_options.add_argument("--log-level=off")
# driver= webdriver.Chrome(options=chrome_options)
# url = 'https://www.flipkart.com/apple-iphone-15-blue-128-gb/p/itmbf14ef54f645d'
# driver= webdriver.Chrome(options= chrome_options)
@app.route('/',methods=["GET"])
def home():
url = request.args.get('url')
if(url):
# driver.get(url)
# html= driver.page_source
html=requests.get(url).content
# print(html)
return html
return "please set an url in get parameters"
app.run(host="0.0.0.0",port=8000,debug=True)
# http://127.0.0.1:8000/?url=https://www.google.com