Python 网站抓取不同的足球现场得分网站

Python 网站抓取不同的足球现场得分网站,python,web-scraping,live,Python,Web Scraping,Live,我需要一个应用程序,我想开发一个数据库中的足球实况分数。我发现的API不完整或者没有我需要的一些功能,从网站上抓取live score站点是否合法?我想我可以刮不同的网站不创造流量,你觉得呢?谢谢我不认为解析网站上的数据是违法的。你可能会想做这样的事情,这是一个程序,它进入一个指定的网页,从一个特定的行中获取数据,并将其保存到一个文件中供另一个程序使用 #this is to get the price of various stocks from Google's search page.

我需要一个应用程序,我想开发一个数据库中的足球实况分数。我发现的API不完整或者没有我需要的一些功能,从网站上抓取live score站点是否合法?我想我可以刮不同的网站不创造流量,你觉得呢?谢谢

我不认为解析网站上的数据是违法的。你可能会想做这样的事情,这是一个程序,它进入一个指定的网页,从一个特定的行中获取数据,并将其保存到一个文件中供另一个程序使用

#this is to get the price of various stocks from Google's search page.     Let's hope this works.
import requests
# Example file for parsing and processing HTML
# import the HTMLParser module
from HTMLParser import HTMLParser
import time

metacount = 0;

x=0
while x==0:
# create a subclass and override the handler methods
class MyHTMLParser(HTMLParser):
    # function to handle character and text data (tag contents)
    def handle_data(self, data):
        #print data
        pos = self.getpos()
        #print "At line: ", pos[0], " position ", pos[1]
        if pos[0]==154:
            price=data
            print price
            # Open a file for writing and create it if it doesn't exist
            f = open("price.txt", "w+")
            # write some lines of data to the file
            f.write(price)
            f.close()
            # Open the file back up and read the contents
            #if = open("price.txt", "r")
            #if f.mode == 'r':  # check to make sure that the file was opened
        # use the read() function to read the entire file
            #   print('true')



def main():
    # instantiate the parser and feed it some HTML
    parser = MyHTMLParser()
    #stock=open('stocks.txt')
    stockname=raw_input('stock symbol')#stock.read()
    r=requests.get('http://stocks.tradingcharts.com/stocks/quotes/'+stockname)
    #print (r.status_code)
    stuff = r.text
    parser.feed(stuff)


if __name__ == "__main__":
    main();
#put it on a timer since the page is updated once every 5 minutes
time.sleep(300)

我不认为从网站上解析数据是违法的。你可能会想做这样的事情,这是一个程序,它进入一个指定的网页,从一个特定的行中获取数据,并将其保存到一个文件中供另一个程序使用

#this is to get the price of various stocks from Google's search page.     Let's hope this works.
import requests
# Example file for parsing and processing HTML
# import the HTMLParser module
from HTMLParser import HTMLParser
import time

metacount = 0;

x=0
while x==0:
# create a subclass and override the handler methods
class MyHTMLParser(HTMLParser):
    # function to handle character and text data (tag contents)
    def handle_data(self, data):
        #print data
        pos = self.getpos()
        #print "At line: ", pos[0], " position ", pos[1]
        if pos[0]==154:
            price=data
            print price
            # Open a file for writing and create it if it doesn't exist
            f = open("price.txt", "w+")
            # write some lines of data to the file
            f.write(price)
            f.close()
            # Open the file back up and read the contents
            #if = open("price.txt", "r")
            #if f.mode == 'r':  # check to make sure that the file was opened
        # use the read() function to read the entire file
            #   print('true')



def main():
    # instantiate the parser and feed it some HTML
    parser = MyHTMLParser()
    #stock=open('stocks.txt')
    stockname=raw_input('stock symbol')#stock.read()
    r=requests.get('http://stocks.tradingcharts.com/stocks/quotes/'+stockname)
    #print (r.status_code)
    stuff = r.text
    parser.feed(stuff)


if __name__ == "__main__":
    main();
#put it on a timer since the page is updated once every 5 minutes
time.sleep(300)

我投票结束这个问题,因为这个问题是关于刮网站的合法性的。你的问题不容易回答。我建议阅读本网站的服务条款。网络上有很多关于网站抓取合法性的文章。我投票将这个问题作为离题来结束,因为这个问题是关于网站抓取合法性的。你的问题不容易回答。我建议阅读本网站的服务条款。网络上有很多关于网络抓取合法性的文章。但是我需要开发一个使用该数据库的公共应用程序,我认为这不太合法,所以我想问,你是想从网页上抓取它,还是想进入为该数据库服务的数据库?一个是合法的,但有些人不赞成,另一个是绝对非法的,如果你没有访问数据库的特权。我想从页面上刮取结果,没有任何使用条款。如果是从页面上,就不应该有任何合法性问题。如果它是可公开访问的,那么任何人和任何东西都可以并且应该能够访问它。它来自一个可公开访问的页面,所以我可以为我的免费应用程序获取和使用数据,谢谢。但我需要开发一个使用该数据库的公共应用程序,我认为这不太合法,所以我想问一下,您是想从网页中删除它,还是想进入为数据库提供服务的数据库?一个是合法的,但有些人不赞成,另一个是绝对非法的,如果你没有访问数据库的特权。我想从页面上刮取结果,没有任何使用条款。如果是从页面上,就不应该有任何合法性问题。如果它是可公开访问的,那么任何人和任何东西都可以并且应该能够访问它。它来自可公开访问的页面,因此我可以为我的免费应用程序获取和使用数据,谢谢。