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
def scrap_covid19_data(): | |
''' function to scrap the COVID19 affected country wise ''' | |
header = { | |
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.75 Safari/537.36", | |
"X-Requested-With": "XMLHttpRequest" | |
} |
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 necessary libraries | |
import pandas as pd | |
import numpy as np | |
import requests | |
from bs4 import BeautifulSoup as bs | |
from datetime import datetime | |
def scrap_covid19_data(): | |
''' function to scrap the COVID19 affected country wise ''' |
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
def scrap_coronaData(): | |
try: | |
file_name='nCOV'+datetime.now().strftime("%d-%m-%Y")+'.csv' | |
# corona_data=pd.read_html('https://www.worldometers.info/coronavirus/#countries')[0]#,header=None)[0] | |
header = { | |
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.75 Safari/537.36", | |
"X-Requested-With": "XMLHttpRequest" | |
} | |
r = requests.get('https://www.worldometers.info/coronavirus/#countries', headers=header, timeout=10) |
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
# from werkzeug.wrappers import Request, Response # for running Flask on Jupyter Lab | |
from flask import Flask, jsonify,redirect, request, render_template, url_for, Markup | |
from coronaScrap import * | |
from multiprocessing import Value #This is Multithreading lib | |
counter = Value('i', 0) | |
app = Flask(__name__) |
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 pandas as pd | |
import numpy as np | |
import requests | |
from bs4 import BeautifulSoup as bs | |
from datetime import datetime | |
def scrap_coronaData(): |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script> |
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
{% extends "layout.html" %} | |
{% block info %} | |
<h2>{{ title|safe }}</h2> | |
{{ posts|safe }} | |
{% endblock %} |
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
table { | |
border: 3.5px solid black; | |
border-collapse: collapse; | |
} | |
th, | |
td { |
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
''' | |
Below code downlaod all the videos in the playlists present | |
''' | |
import re,os | |
from pytube import Playlist,YouTube | |
# YOUTUBE_STREAM_AUDIO = '480' # modify the value to download a different stream | |
DOWNLOAD_DIR = os.getcwd()+'newDownload' |
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
class createLog: | |
def formatLog(filename): | |
import os, logging | |
logfilename = os.path.join(os.path.expanduser('~'), 'xyz', '{0}.log'.format(filename)) | |
print('Log file path : Home/xyz/{}'.format(logfilename)) | |
# create logger | |
logger = logging.getLogger(__name__) | |
logger.setLevel(logging.DEBUG) | |
# create console handler and set level to debug |
OlderNewer