Em Andamento

Update web scraping code of existing Python script

Need to update code below to scrape data from an updated website that now has data formatted on the screen differently.

Only the part of the code that scrapes the data and sends to a file needs to be updated.

The new website address is [url removed, login to view]

I have very small budget as this is just a hobby project for my personal use. I also expect this to be very easy for anyone who knows what they are doing. Many thanks in advance.

Here is the original code:

import [url removed, login to view]

import csv

import re

import json

import time

import os

import smtplib

reToken = [url removed, login to view]('RefreshCallback\((.+)\)')

filename_ = "[url removed, login to view]"

def saveHeader(data):

if not [url removed, login to view](filename_):

saveContent(data)

def saveContent(data):

with open(filename_, 'a', encoding='utf-16', newline='') as f:

w = [url removed, login to view](f, delimiter='\t', quotechar='"', quoting=csv.QUOTE_MINIMAL)

# print(data)

[url removed, login to view](data)

# main

url = "[url removed, login to view]"

while (True):

curTime = [url removed, login to view]()

print ("Monitoring server activity ...")

httpData = [url removed, login to view](url).read().decode("utf-8", 'ignore')

data = [url removed, login to view](httpData)[0]

saveHeader(["mod_name", "cur_players", "max_players", "server_name", "track_name", "has_password", "timestamp"])

jsonData = [url removed, login to view](data)

for item in jsonData:

#saveContent([item["fields"]["mod_name"], item["fields"]["cur_players"], item["fields"]["max_players"], item["fields"]["server_name"], item["fields"]["track_name"], item["fields"]["has_password"], curTime])

#print (item["fields"]["server_name"])

if item["fields"]["server_name"] == "LolaT280LochDrummond" and item["fields"]["cur_players"] > 1:

SMTP_SERVER = '[url removed, login to view]'

print("Someone has joined your room!")

SMTP_PORT = 587

sender = '[put sending email here]'

recipient = '[put receiving email here]'

subject = 'Someone has joined your room!'

body = 'blah blah blah'

"Sends an e-mail to the specified recipient."

body = "" + body + ""

headers = ["From: " + sender,

"Subject: " + subject,

"To: " + recipient,

"MIME-Version: 1.0",

"Content-Type: text/html"]

headers = "\r\n".join(headers)

session = [url removed, login to view](SMTP_SERVER, SMTP_PORT)

[url removed, login to view]()

[url removed, login to view]()

[url removed, login to view]

[url removed, login to view](sender, "[put your email password here]")

[url removed, login to view](sender, recipient, headers + "\r\n\r\n" + body)

[url removed, login to view]()

print("Done. Sleeping ... ")

[url removed, login to view](60)

Habilidades: Python

Ver mais: world code no, web scraping part time, web scraping https, small project in python, scraping web content, scraping e commerce web, scraping a server, need a screen writer, mail request to content writer, html code for e commerce website, e mail writer, decode a password, content writer in commerce, content writer for commerce, code 8 com, blah blah your needs, what is data scraping, web scraping with r, python writer, python csv to json, list of web servers, callback url, r web scraping, Web Scraping email, version of existing website

Acerca do Empregador:
( 9 comentários ) Lexington, United States

ID do Projeto: #6797305

Premiar a:

irth7

I have already wrote the code. It is well commented and readable. Your code sends an email every 60 seconds if someone is on your server. My code sends the email only when someone joins the server, so it doesn't spam t Mais

$10 USD em 0 dias
(0 Avaliações)
0.0

3 freelancers estão ofertando em média $13 para este trabalho

tzo

A proposal has not yet been provided

$20 USD em 1 dia
(31 Comentários)
5.1
abdullahnaseer

i have recently learn python from udacity and codecademy. you can give this work to me. Thank you. Abdullah

$10 USD em 1 dia
(0 Comentários)
0.0