electricitymap scrap

This commit is contained in:
Tykayn 2023-09-14 16:20:59 +02:00 committed by tykayn
parent 072b5b53d2
commit 88ee36a8d4
10 changed files with 15801 additions and 0 deletions

View File

@ -0,0 +1,45 @@
import * as le_json from "./electricitymap_yearly.json" assert {type: 'json'}
let elec_data = le_json['default']
let fr_zone = Object.keys(elec_data.data.zones.FR)
let de_zone = Object.keys(elec_data.data.zones.DE)
console.log('fr_zone', fr_zone)
console.log('de_zone', de_zone)
let scraped_data_account_keys_fr = fr_zone
let scraped_data_account_keys_de = de_zone
console.log('scraped_data_account_keys_fr', scraped_data_account_keys_fr)
console.log('scraped_data_account_keys_de', scraped_data_account_keys_de)
let average_fr = 0
let average_de = 0
let factor = 1
let ii_fr=1;
let somme_fr=0;
let ii_de=1;
let somme_de=0;
scraped_data_account_keys_fr.forEach(elem => {
console.log('fr ',elem.substring(0,4),elec_data.data.zones.FR[elem].co2intensity)
somme_fr += elec_data.data.zones.FR[elem].co2intensity
ii_fr++
})
average_fr = somme_fr / ii_fr;
scraped_data_account_keys_de.forEach(elem => {
console.log('de ',elem.substring(0,4),elec_data.data.zones.DE[elem].co2intensity)
somme_de += elec_data.data.zones.DE[elem].co2intensity
ii_de++
})
average_de = somme_de / ii_de;
factor = ( average_de / average_fr )
console.log('la france a émis en moyenne '+ Math.round(factor,2)+' fois moins de gaz à effet de serre par habitant via son mix électrique que l\'allemagne au cours des 6 dernières années .')
console.log('la france : '+Math.round(average_fr,2)+' gCO2 eq/kWh/hab.')
console.log('l\'allemagne : '+Math.round(average_de,2)+' gCO2 eq/kWh/hab.')
console.log(' https://ourworldindata.org/grapher/co-emissions-per-capita?tab=chart&time=1963..latest&country=OWID_EU27~FRA~DEU ')
// comparer aussi les consommations d'énergie primaire via ourworldindata

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,9 @@
from twitter_scraper_selenium import scrape_profile
one_account="voixdunucleaire"
posts_of_account = scrape_profile(twitter_username=one_account,
output_format="json",
browser="firefox",
tweets_count=50,
# since="2023-09-10"
)
print(posts_of_account)

View File

@ -0,0 +1,4 @@
#!/usr/bin/zsh
wget https://app-backend.electricitymap.org/v7/state/yearly -O electricitymap_yearly.json
#wget https://app-backend.electricitymap.org/v6/state/daily -O electricitymap_daily.json

View File

@ -0,0 +1,8 @@
from linkedin_scraper import Person, actions
from selenium import webdriver
driver = webdriver.Chrome()
email = "contact@cipherbliss.com"
password = "*#2i2Nb3DU1OmyA283Mz&B5V20h@J3t40800d6ws89gea22155^6"
actions.login(driver, email, password) # if email and password isnt given, it'll prompt in terminal
person = Person("https://www.linkedin.com/in/maxence-cordiez", driver=driver)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1,14 @@
import * as scraped_data_account from "./output_json.json" assert {type: 'json'}
let scraped_data_account_keys = Object.keys(scraped_data_account['default'])
console.log('scraped_data_account_keys', scraped_data_account_keys.sort())
scraped_data_account_keys.forEach(elem => {
console.log('- ',scraped_data_account['default'][elem].posted_time)
console.log('- ',scraped_data_account['default'][elem].content)
console.log('',)
})
// console.log('scraped_data_account', scraped_data_account)

View File

@ -0,0 +1,10 @@
from twitter_scraper_selenium import scrape_keyword
#scrape 10 posts by searching keyword "india" from date 30th August till date 31st August
topic_out = scrape_keyword(keyword="climat",
browser="firefox",
tweets_count=20,
output_format="json" ,
# until="2021-08-31",
since=date.today().format('YYYY-MM-DD')
print(topic_out)