Таблицы не найдены ошибка при выполнении запроса AJAX

Replace Входит как опция. Или вы можете проверить с помощью

IF NOT EXISTS(QUERY) Then INSERT

Это вставляет или удаляет, а затем вставляет. Сначала я предпочитаю проверку IF NOT EXISTS.

0
задан Christian Ipanaque 19 January 2019 в 09:29
поделиться

2 ответа

URL сборки для Ajax-запроса, для 2017 - CCC это похоже на

url = 'https://.......com/result.php?mode=edPass&ajax=true&annee=2017&course=ccc'
data = pd.read_html(url, header = 0)
print(data[0])
0
ответ дан ewwink 19 January 2019 в 09:29
поделиться

Вы также можете использовать селен, если не можете найти другие хаки.

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from time import sleep
from bs4 import BeautifulSoup as BSoup
import pandas as pd
url = "https://utmbmontblanc.com/en/page/107/results.html"
driver = webdriver.Chrome("/home/bitto/chromedriver")#change this to your chromedriver path
year = 2017
driver.get(url)
element = WebDriverWait(driver, 10).until(
    #changes div[@class='bloc'] to change year  - [1] for 2018, [2] for 2017 etc
    #change index of div[@class='row'] - [1], [2] for TDS etc
    #change @value of option match your preferred option's value - you can find this from the inspect tool - First two are Scratch and ScratchH
    EC.presence_of_element_located((By.XPATH, "//div[@class='bloc'][2]/div[@class='row'][4]/span[@class='selectbutton']/select[@name='cat'][1]/option[@value='Scratch']"))
)
element.click()#select option
#make relevant changes you made in top here also
driver.find_element_by_xpath("//div[@class='bloc'][2]/div[@class='row'][4]/span[@class='selectbutton']/input").click();#click go
sleep(10)#not preferred but will do for now
table=pd.read_html(driver.page_source)
print(table)

Выход

[      GeneralRanking                       Family name First name  Club Cat.        ...             Time Difference/ 1st       Nationality
0                  1                  3001  - HAWKS Hayden HOKA ONE ONE  SEH        ...         10:24:30        00:00:00     United States
1                  2   3018  - ŚWIERC Marcin SALOMON SUUNTO TEAM POLAND  SEH        ...         10:42:49        00:18:19            Poland
2                  3                 3005  - POMMERET Ludovic TEAM HOKA  V1H        ...         10:50:47        00:26:17            France
3                  4                3214  - EVANS Thomas COMPRESS SPORT  SEH        ...         10:57:44        00:33:14    United Kingdom
4                  5                          3002  - OWENS Tom SALOMON  SEH        ...         11:03:48        00:39:18    United Kingdom
5                  6                3011  - JONSSON Thorbergur 66 NORTH  SEH        ...         11:14:22        00:49:52           Iceland
6                  7       3026  - BOUVIER-GAZ Nicolas TEAM NEW BALANCE  SEH        ...         11:18:33        00:54:03            France
7                  8           3081  - JONES Michael WWW.APEXRUNNING.CO  SEH        ...         11:31:50        01:07:20    United Kingdom
8                  9               3020  - COLLET Aurélien HOKA ONE ONE  SEH        ...         11:33:10        01:08:40            France
9                 10               3009  - MARAVILLA Jorge HOKA ONE ONE  V1H        ...         11:36:14        01:11:44     United States
10                11                       3036  - PERRILLAT Christophe  SEH        ...         11:40:05        01:15:35            France
11                12         3070  - FRAGUELA BREIJO Alejandro STUDIO54  V1H        ...         11:40:11        01:15:41             Spain
12                13                          3092  - AIGROZ Mike TRUST  SEH        ...         11:41:53        01:17:23       Switzerland
13                14               3021  - O'LEARY Paddy THE NORTH FACE  SEH        ...         11:47:04        01:22:34           Ireland
14                15  3065  - PÉREZ TORREGLOSA Juan CLUB ULTRATRAIL ...  SEH        ...         11:47:51        01:23:21             Spain
15                16  3031  - SÁNCHEZ CEBRIÁN Miguel Ángel LURBEL-LI...  V1H        ...         11:49:15        01:24:45             Spain
16                17                             3062  - ANDREWS Justin  SEH        ...         11:49:47        01:25:17     United States
17                18             3039  - PIANA Giulio TEAM MUD AND SNOW  SEH        ...         11:50:23        01:25:53             Italy
18                19  3047  - RONIMOISS Andris Inov8 / OSveikals.lv ...  SEH        ...         11:52:25        01:27:55            Latvia
19                20            3052  - DURAND Regis TEAM TRAIL ISOSTAR  V1H        ...         11:56:40        01:32:10            France
20                21                        3027  - SANDES Ryan SALOMON  SEH        ...         12:04:39        01:40:09      South Africa
21                22  3014  - EL MORABITY Rachid ULTRA TRAIL ATLAS T...  SEH        ...         12:10:01        01:45:31           Morocco
22                23                       3067  - JONES Harry RUNIVORE  SEH        ...         12:10:12        01:45:42    United Kingdom
23                24                             3030  - CLAVERY Erik -  SEH        ...         12:12:56        01:48:26            France
24                25  3056  - JIMENEZ LLORENS Juan Maria GREEN POWER...  SEH        ...         12:13:18        01:48:48             Spain
25                26             3024  - GALLAGHER Clare THE NORTH FACE  SEF        ...         12:13:57        01:49:27     United States
26                27  3136  - ASSEL Garry LICENCE INDIVIDUELLE LUXEM...  SEH        ...         12:20:46        01:56:16        Luxembourg
27                28     3071  - RIGODANZA Francesco SPIRITO TRAIL TEAM  SEH        ...         12:22:49        01:58:19             Italy
28                29      3118  - POLASZEK Christophe CHARTRES VERTICAL  V1H        ...         12:24:49        02:00:19            France
29                30  3125  - CALERO RODRIGUEZ David Altmann Sports/...  SEH        ...         12:25:07        02:00:37             Spain
...              ...                                                ...  ...        ...              ...             ...               ...
1712            1713                               5734  - GOT Hang Fai  V2H        ...         26:25:01        16:00:31  Hong Kong, China
1713            1714            4154  - RAMOS Liliana NIKE RUNNING CLUB  V3F        ...         26:26:22        16:01:52         Argentina
1714            1715                  5448  - BECKRICH Xavier PHOENIX57  V1H        ...         26:26:45        16:02:15            France
1715            1716        5213  - BARBERIO ARNOULT Isabelle PHOENIX57  V1F        ...         26:26:49        16:02:19            France
1716            1717                  4704  - ZHANG Zheng XIAOMABENTENG  SEH        ...         26:28:37        16:04:07             China
1717            1718                          5282  - GUISOLAN Frédéric  SEH        ...         26:28:46        16:04:16       Switzerland
1718            1719                              5306  - MEDINA Rafael  V1H        ...         26:29:26        16:04:56            Mexico
1719            1720                          5379  - PENTCHEFF Nicolas  SEH        ...         26:33:05        16:08:35            France
1720            1721        4665  - GONZALEZ SUANCES Israel BAR ES PUIG  V1H        ...         26:33:58        16:09:28             Spain
1721            1722                              4389  - TONANNY Marie  SEF        ...         26:34:51        16:10:21            France
1722            1723                            5616  - GLORIAN Thierry  V2H        ...         26:35:47        16:11:17            France
1723            1724                     5684  - CHEUNG Ho FAITHWALKERS  V1H        ...         26:37:09        16:12:39  Hong Kong, China
1724            1725                 5719  - GANDER Pascal JEFF B TRAIL  SEH        ...         26:39:04        16:14:34            France
1725            1726                       4555  - JURGIELEWICZ Urszula  SEF        ...         26:39:44        16:15:14            Poland
1726            1727  4722  - HIDALGO José Miguel C.D. ATLETISMO SAN...  V1H        ...         26:40:27        16:15:57             Spain
1727            1728                          4425  - JITTIWUTIKARN Gif  V1F        ...         26:41:02        16:16:32          Thailand
1728            1729                                   4556  - ZHU Jing  SEF        ...         26:41:12        16:16:42             China
1729            1730                                  4314  - HU Dongli  V1H        ...         26:41:27        16:16:57             China
1730            1731              4239  - DURET Estelle OXYGENE BELBEUF  V1F        ...         26:41:51        16:17:21            France
1731            1732  4525  - MAGLIERI Fabrice ATHLETIC CLUB PAYS DE...  V1H        ...         26:42:11        16:17:41            France
1732            1733        4433  - ANDERSEN Laura Jentsch RUN DEM CREW  SEF        ...         26:42:27        16:17:57           Denmark
1733            1734           4563  - CHEUNG Annie On Nai FAITHWALKERS  V1F        ...         26:45:35        16:21:05  Hong Kong, China
1734            1735                4355  - KHALED Naïm GENEVE AEROPORT  SEH        ...         26:47:50        16:23:20           Algeria
1735            1736            4749  - STELLA Sara COURMAYEUR TRAILERS  V1F        ...         26:48:07        16:23:37             Italy
1736            1737                             4063  - LALIMAN Leslie  SEF        ...         26:48:09        16:23:39            France
1737            1738      5702  - BURKE Tony Alchester/CTR/Bicester Tri  V2H        ...         26:50:52        16:26:22           Ireland
1738            1739          5146  - OLIVEIRA Sandra BUDEGUITA RUNNERS  V1F        ...         26:52:23        16:27:53          Portugal
1739            1740  5545  - VELLANDI Emilio TEAM PEGGIORI SCARPA MICO  V1H        ...         26:55:32        16:31:02             Italy
1740            1741          5543  - GASPAROVIC Bernard STADE FRANCAIS  V3H        ...         26:56:31        16:32:01            France
1741            1742            4760  - MENDONCA Carine ASPTT COMPIEGNE  V2F        ...         27:19:15        16:54:45           Belgium

[1742 rows x 7 columns]]
0
ответ дан marc_s 19 January 2019 в 09:29
поделиться
Другие вопросы по тегам:

Похожие вопросы: