yahoo weather country and city list - yahoo

when i need get weather for some city i put this link:
http://weather.yahooapis.com/forecastrss?w=713169
But how get all country city code(id)?
Maybe is some xml, rss?
Thanks

see this: forecastrss?w=713169
This w parameter is your WOEID. WOEID is invented by yahoo I think and means WehereOnEarthID. So do a google search for WOEID list and you`ll find the answer.

Related

What XPath expression should I use to fetch the number of likes and comments on a YouTube video?

I'm using the "IMPORTXML" function on Google Spreadsheets to get the number of likes and comments on any given YouTube video. However, I can't find the right XPath, and all I've tried return an empty value.
I used ChroPath to extract the XPath of the comments and likes count, but to no success.
This is the XPath that I've been using for amount of comments:
//yt-formatted-string[#class='count-text style-scope ytd-comments-header-renderer']
And this is for amount of likes:
//div[#id='info']//ytd-toggle-button-renderer[1]//a[1]//yt-icon-button[1]
When I try those it just says the content is empty. What is the correct XPath that I should be using to get the number of likes and comments?
You want to retrieve the number of likes of the video on YouTube.
You want to put the value to the Spreadsheet.
How about this formula? Please think of this as just one of several answers.
Sample formula:
=VALUE(IMPORTXML(A1,"//button[#title='I like this']/span"))
In this case, the cell "A1" is the URL like https://www.youtube.com/watch?v=###.
Xpath is //button[#title='I like this']/span".
Sample script of Google Apps Script:
As another method for retrieving the number of likes, if you use Advanced Google services of Google Apps Script, the sample script is as follows.
var count = YouTube.Videos.list("statistics", {id: "###"}).items[0].statistics.likeCount;
### is the video's ID.
References:
IMPORTXML
VALUE
Advanced Google services
Videos: list
If I misunderstood your question and this was not the result you want, I apologize.
for YT likes you could use:
=IF(ISNA(IMPORTXML("https://www.youtube.com/watch?v=MkgR0SxmMKo","(//*[contains(#class,'like-button-renderer-like-button')])[1]"))=TRUE,0,
IMPORTXML("https://www.youtube.com/watch?v=MkgR0SxmMKo","(//*[contains(#class,'like-button-renderer-like-button')])[1]"))

Possible algorithms to solve this problem

I have a list of extracted names of one hotel , and these are the names taken by n websites about the same hotel . The list contains m names about 1 hotel . I have to select one name from the list based on correctness , similarity , less mistakes . How can I achieve this ?
Any direction is helpful .
Example: List of names for hotelId 1 {"ABC Hotel","CDE hotel" , "Hotel ABC" ,"AB Hotel" , "Hotel BCA" ...}
With the initital research it looks like a graph related problem
This is not gonna work. You will not get similarities based on the names. Especially if almost every hotel has the keyword hotel in its name.
You need more information to match similarities.
Address, Geo location, attributes about the hotel could also help (wifi, parking, close to beach, pool), if this is a chain and so on. The more information you have the better the matching result you can get.
You can try to leverage some of Bing or Google APIs --> i.e. do a search for the hotel name with some details from address in Search APIs or in some Map APIS (e.g. search for ["ABC Hotel 5AV Philliadelphia","CDE hotel 5AV Philliadelphia" , "Hotel ABC 5AV Philliadelphia",..] then compare your data with the API response.

geotext library is not picking up the correct name of cities in python

Hi I am new bee in python and we are trying to find the country ,cities name from geotext library of python but it is not picking every name correctly. could anyone please suggest what should be wrong.
While reading the data from email it is picking up "Mobile" as city which is in SIgnature of email
from geotext import GeoText
places = GeoText("Hi , We need to book a flight from Mumbai to London on 13 Aug throuigh shivaji terminal.
Regards,
xyz
Mobile : 5368536
")
Output : ['Mumbai' ,'Moble']
please help
There are three cities named 'Mobile' in various states the US. You cannot avoid picking it up (unless you decide to block that specific word as being a city - but there could easily be other cities with names that match common words).

Strange results from Google places autocomplete for sequence of repeating letters

This call https://maps.googleapis.com/maps/api/place/autocomplete/xml?input=qqqqqqq (plus your key) returns addresses like 'qqqqqqqqqq, Florida, USA' and 'qqqqqqqqqqqqqqqqqqqqqqqq - Luizote de Freitas, Uberlândia - State of Minas Gerais, Brazil'. I understand that QQQ might be a valid name, but qqqqqqqqqqqqqqqqqqqqqqqq? And it works the same way for any sequence of repeating letters or numbers.
Ok, let's say this is google having bad data. But how to explain results for 'www': 'Best Buy, Middlesex Turnpike, Burlington, MA, USA', 'Acton Toyota of Littleton, Great Road, Littleton, MA, USA'? I do not see any sane correlation between 'www' and the results.
You can see similar behaviour in google maps, so it's not just autocomplete API.
Any theories?
When I execute request https://maps.googleapis.com/maps/api/place/autocomplete/json?input=www&key=MY_API_KEY from my location I get really weird predictions as well
Montpellier, France (place ID ChIJsZ3dJQevthIRAuiUKHRWh60, type locality)
Berlin, Germany (place ID ChIJAVkDPzdOqEcRcDteW0YgIQQ, type locality)
Hamburg, Germany (place ID ChIJuRMYfoNhsUcRoDrWe_I9JgQ, type locality)
Munich, Germany (place ID ChIJ2V-Mo_l1nkcRfZixfUq4DAE, type locality)
Vienna, Austria (place ID ChIJn8o2UZ4HbUcRRluiUYrlwv0, type locality)
Note all of them have locality type, and indeed it smells like a bug, because I cannot see how on earth the text 'www' might match these predictions. Apparently, something is broken on Google backend and leads to the strange behavior in places autocomplete.
I can confirm that I can see this problem on Google Maps web site as well
At this point I believe the best option for us is sending a feedback to Google Maps team and hope they will fix it soon.

Google Sheets Importxml Xpath

I am trying to import both the link to the Google Maps image and the address of the council from https://www.google.com.au/?gws_rd=ssl#q=Albany+City+council+address&time=445678
I have tried all sorts of Xpath expressions and keep getting a result saying the imported results were empty.
For the address I have tried:
//*[#class='_uX kno-fb-ctx']
//div[#class='_eF']
//*[#class='_eF']
//div/div/div/div/div/div/div/div/div/ol/li/div/div/div/ol/li/div
The info I want appears in 3 places on that page - so any Xpath that gets it from one of these locations is what I am looking for:
<div class="_uX kno-fb-ctx" aria-level="3" role="heading" data-hveid="29" data-ved="0CB0QtwcoADAA"><div class="_eF">102 North Road, Yakamia WA 6330</div>
id="lnv_href"></a></div></td><td valign="top" style="color:#222;line-height:1.24">102 North Road, Yakamia WA 6330
<div class="_lR"><div class="_mr"><span style="font-weight:bold">Address:</span> <span>102 North Road, Yakamia WA 6330</span>
Any help would be greatly appreciated.
1) info You want appears in 2 places on that page, probbably the best way is to use Xpath construction with contains.
2) for map use
//*[#id="media_result_group"]/ol/div/div/div/div[2]/div/div[3]/a/img/#src
or simple
//div[#class="rhsg4 rhsmap5col"]/a/img/#src
In my opinion, you can't do that because those data from Google result page can't be rendered easily by xpath into google spreadsheet. The reason is they are rendered by javascript (more tech savvy guys will correct me if I am wrong).
The answer marked correct is incorrect. The content I was looking for is HTML and is able to be captured with ImportHTMl("URL" "table",4) but I did need to add WA (stands for Western Australia) to the search string.

Resources