I'm trying to do a document.writeln function based on a keyword search. If the user searches for the terms:
**widget xyz
xyz **widget**
my **widget** works
The searches are currently displayed this url format:
?Search=**widget**+xyz
?Search=xyz+**widget**
?Search=my+**widget**+
works
I would like to perform document.writeln on pages with the key word **widget** included in the search.
Here is where I'm at:
EXAMPLE 1:)
if (location.search == "**widget**")
document.writeln("\n<style type='text/css'>CUSTOM CSS</style>\n\n");
EXAMPLE 2:)
if (location.search == "**widget**"!= -1)
document.writeln("\n<style type='text/css'>CUSTOM CSS</style>\n\n");
The 2nd example kind of works, but shows the WriteIn on other keyword search results as well. Any help is much appreciated!
Related
I'm trying to use VBA in Excel, to navigate a site with Internet explorer, to download an Excel file for each day.
After looking through the HTML code of the site, it looks like each day's page has a similar structure, but there's a portion of the website link that seems completely random. But this completely random part stays constant and does not change each time you want to load the page.
The following portion of the HTML code contains the unique string:
<a href="#" onClick="showZoomIn('222698519','b1a9134c02c5db3c79e649b7adf8982d', event);return false;
The part starting with "b1a" is what is used in the website link. Is there any way to extract this part of the page and assign it as a variable that I then can use to build my website link?
Since you don't show your code, I will talk too in general terms:
1) You get all the elements of type link (<a>) with a Set allLinks = ie.document.getElementsByTagName("a"). It will be a vector of length n containing all the links you scraped from the document.
2) You detect the precise link containing the information you want. Let's imagine it's the 4th one (you can parse the properties to check which one it is, in case it's dynamic):
Set myLink = allLinks(3) '<- 4th : index = 3 (starts from zero)
3) You get your token with a simple split function:
myToken = Split(myLink.onClick, "'")(3)
Of course you can be more synthetic if the position of your link containing the token is always the same, like always the 4th link:
myToken = Split(ie.document.getElementsByTagName("a")(3).onClick,"'")(3)
I’m trying to search all film with word “Seven”. It found 50 films. But some films and its description does not contain word “Seven”. For example film with trackId = 421072264 not contain word “Seven”.
Is iTunes search API working correctly?
https://itunes.apple.com/search?term=Seven&entity=movie
I attached response to Search%3DSeven.txt file.
https://dl.dropboxusercontent.com/u/55328092/Search%3DSeven.txt
Yes this is working correctly, the search defaults to a broader set of data to search on when no attribute parameter is specified in the query.
You can reduce the search parameters by setting a value for attribute the the query, however this will still not stop it from returning films with 7 in their title, this seem to just be a quirk of the search algorithm.
https://itunes.apple.com/search?term=Seven&entity=movie&attribute=movieTerm
Weirdly this returns "Fast & Furious 5 - 7 Collection" before "Seven" which doesn't make much sense.
If it needs to be more precise then a id search can be done which would only return the specified movie
https://itunes.apple.com/lookup?id=534912090
See this link for more details on how to modify the search query and lookup searches:
https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/#searching
I have a Drupal 7 website that is running apachesolr search and is using faceting through the facetapi module.
When I use the facets to narrow my searches, everything works perfectly and I can see the filters being added to the search URL, so I can copy them as links (ready-made narrowed searches) elsewhere on the site.
Here is an example of how the apachesolr URL looks after I select several facets/filters:
search_url/search_keyword?f[0]=im_field_tag_term1%3A1&f[1]=im_field_tag_term2%3A100
Where the 'search_keyword' portion is the text I'm searching for and the '%3A' is just the url encoded ':' (colon).
Knowing this format, I can create any number of ready-made searches by creating the correct format for the URL. Perfect!
However, these filters are always ANDed, the same way they are when using the facet interface. Does anyone know if there is a syntax I can use, specifically in the search URL, to OR my filters/facets? Meaning, to make it such that the result is all entries that contains EITHER of the two filters?
New edit:
I do know how to OR terms for one facet through the URL im_field_tag_term1:(x or y) but I need to know how to apply OR condition between two facets .
Thanks in advance .
Google Analytics API: how to extract pageviews for a specific page?
I tried using something like
ga:pagePath=~page.php%3fid%3d44 (page.php?id=44)
but it doesn't seem to work... I get "no results found" where I have 20 pageviews for sure
UPDATE
I think I found the solution
ga:pagePath==/website/page.php?id=44
for some reason I had to include the complete path and ==
To use a partial path to match for a page in filters you should use
ga:pagePath=#page.php?id=44
=# tells ga to match a substring.
What you were originally using was incorrect for this.
I think your problem is that you put the hex version of the ? and = characters into your query, which doesn't match how Analytics stores the page paths. If you change these to the normal characters it should work:
ga:pagePath=~page.php?id=44
Your other solution should work as well but is a bit more inflexible in case you wanted to tweak the query to return other pages.
I am making some PHP code which takes a given search phrase and url and searches through the google search results until it finds the url (only first 100 results). My problem is, this is only working for the US. I have tried adding the "&cr=" option, but it still on returns US results.
The full URL I am using for the request is:
https://www.googleapis.com/customsearch/v1?key=API_KEY&cx=CX_VALUE&q=KEYWORD&cr=COUNTRY&alt=JSON
Does anyone have any experience with this? I want to be able to see UK results. Tried inserting &cr=countryUK , but still only does US results.
Thanks :)
Regards,
Stian
Use the gl=<country code> param to limit it to your country of choice (so gl=gb for the uk).
More info here:
http://googleajaxsearchapi.blogspot.com/2009/10/web-search-in-your-country.html