• 0
Votes
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 195

Backtrace:

File: /home/u125378470/domains/lawhelpguru.org/public_html/application/views/question.php
Line: 195
Function: _error_handler

File: /home/u125378470/domains/lawhelpguru.org/public_html/application/controllers/Questions.php
Line: 416
Function: view

File: /home/u125378470/domains/lawhelpguru.org/public_html/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

how to do web scraping map using two drop down menus?

I am new to webscraping.I have been trying to extract the business information such as ShopName and the business Address. There are two drop down menus. One correspond to the province and the other one correspond to the district. I went to the network tab inside the developer tools. Once I selected the respective province and district,I get a JSON format response for which I tested a code to extract the shopName and Info.Here's the code for the first province and first district:

import requests


headers = {
    'Connection': 'keep-alive',
    'Accept': '*/*',
    'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36',
    'X-Requested-With': 'XMLHttpRequest',
    'Sec-Fetch-Site': 'same-origin',
    'Sec-Fetch-Mode': 'cors',
    'Sec-Fetch-Dest': 'empty',
    'Referer': 'https://xn--b3cuh3bhdeppad0as7a5dybu5qd4a3kl8e.moc.go.th/MarkerShop',
    'Accept-Language': 'en-US,en;q=0.9,hi;q=0.8,bg;q=0.7,sv;q=0.6',
}

params = (
    ('prov', '81'),
    ('amphur', '8101'),
)

response = requests.get('https://xn--b3cuh3bhdeppad0as7a5dybu5qd4a3kl8e.moc.go.th/api/shopapi/getshopicon', headers=headers, params=params)


master_list=[]
for detail in details:
    data_dict={}
    invalid_tags = ['\r', '\n', '<', '>', '-', ';','
'
,'','','/b',"img src='icon/icon_y.png'"," ","brb","imgsrc='icon/icon_g.png'"] for invalid_tag in invalid_tags: detail['Address'] = detail['Address'].replace(invalid_tag, '') detail['ShopName'] = detail['ShopName'].replace(invalid_tag,'') data_dict["Address_new"]=detail['Address'] data_dict['Shop']=detail['ShopName'] master_list.append(data_dict)

The above code gives me the required output for the first province and the first district. I want to loop over the rest of the province and their respective districts. I have been trying to find out answers. What I see is that people have using selenium to go through the drop down lists and maybe AJAX to request calls. I am not familiar with AJAX but just have some preliminary information. Please suggest of how to get the required information.

Here's the link(thai language). It has all the business information displayed on a map.

https://xn--b3cuh3bhdeppad0as7a5dybu5qd4a3kl8e.moc.go.th/MarkerShop#gomap