Google feed api deprecated, How can i find rss feed of web site? [closed] - api

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I used Google Feed API for finding rss feeds of special keywords or websites, now this api deprecated, so i need alternative way for finding rss of website, I google it but i cannot find any good way..
Find rss from parsing html of website is not good for me because i want to find all rss from any subdomains of it.
For example in the past when with using Google Feed API i give ieee.org and get all rss like:
http://www.ieee.org/rss/index.html?feedId=News_Release
http://spectrum.ieee.org/rss/fulltext
http://spectrum.ieee.org/rss/blog/automaton/fulltext
and ....
So, Is there any api or services that i can find all of rss feeds of website?

Feedly's API could fit your requirements. See https://developer.feedly.com/v3/search/
Pass the site's domain name as query parameter and you'll get rss feed matches:
https://cloud.feedly.com/v3/search/feeds/?query=ieee.org

You can use rss2json API to get feed data same as google feed API did.
var url = "http://www.espncricinfo.com/rss/content/feeds/news/8.xml"; //feed url
var xhr = createCORSRequest("GET","https://api.rss2json.com/v1/api.json?rss_url="+url);
if (!xhr) {
throw new Error('CORS not supported');
} else {
xhr.send();
}
xhr.onreadystatechange = function() {
if (xhr.readyState==4 && xhr.status==200) {
var responseText = xhr.responseText;
var result = JSON.parse(responseText);
console.log(result);
}
}
function createCORSRequest(method, url) {
var xhr = new XMLHttpRequest();
if ("withCredentials" in xhr) {
xhr.open(method, url, true);
} else if (typeof XDomainRequest != "undefined") {
xhr = new XDomainRequest();
xhr.open(method, url);
} else {
xhr = null;
}
return xhr;
}

Related

Need t2.gstatic URL parameters for Web Scraping

I am checking to see if I can use gstatic to scrape favicon from websites. Below will fetch the websites Favicon:
https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=https://yahoo.com&size=64
I understand that the URL parameters might not be for general use, but just checking if anyone knows where this might be documented?
UPDATE: I have just started building an app on Google App Script. I need to list website names along with their favicons and metadata like site description, etc. Currently the only approach is to read the webpage and use beautifulSoup to parse the page and then locate the favicon. I came across the above link that will directly give me the favicon! But I want to understand it better and trying to locate more information on the URL parameters for gstatic.
I am also open to alternative ways to scrape a web site from Google App Script...
Thanks
I believe your goal is as follows.
You want to retrieve the favicon from the websites.
You want to use the following sample URL.
https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=https://yahoo.com&size=64
From I need to list website names along with their favicons and metadata like site description, etc., you want to retrieve the favicon, title, and description of the site using Google Apps Script.
Sample script 1:
When your URL of https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=https://yahoo.com&size=64 is used, how about the following sample script? Please copy and paste the following script to the script editor of Google Apps Script. And, run samoke1 at the script editor.
function sample1() {
const uri = 'https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=https://yahoo.com&size=64';
const blob = UrlFetchApp.fetch(encodeURI(uri)).getBlob();
DriveApp.createFile(blob);
}
When this script is run, the favicon is retrieved and that is saved as a file to the root folder of Google Drive.
When I saw the URL, it seems that the favicon is retrieved as the image data.
Sample script 2:
When the favicon, title, and description of the site are retrieved, how about the following sample script?
function sample2() {
const uri = 'https://yahoo.com'; // Please set the URL.
const obj = { title: "", description: "", faviconUrl: "" };
const res = UrlFetchApp.fetch(encodeURI(uri));
const html = res.getContentText();
const title = html.match(/<title>(.+?)<\/title>/i);
if (title || title.length > 1) {
obj.title = title[1];
}
const description = html.match(/<meta.+name\="description".+>/i);
if (description) {
const d = description[0].match(/content\="(.+)"/i);
if (d && d.length > 1) {
obj.description = d[1];
}
}
const faviconUrl = html.match(/rel="icon".+?href\="(.+?)"/i);
if (faviconUrl && faviconUrl.length > 1) {
obj.faviconUrl = faviconUrl[1];
}
console.log(obj);
}
When this script is run, you can see the following value in the log.
{
"title":"Yahoo | Mail, Weather, Search, Politics, News, Finance, Sports & Videos",
"description":"Latest news coverage, email, free stock quotes, live scores and video are just the beginning. Discover more every day at Yahoo!",
"faviconUrl":"https://s.yimg.com/cv/apiv2/default/icons/favicon_y19_32x32_custom.svg"
}
Reference:
fetch(url)

google indexes URLs with ?m=1 ending on blogger

who can we fix it!
Hello I have blogger with (https://ezzeddinisalm.blogspot.com) and before two days I bought new domain from google (islamink.com) and connected it (same blog) with using redirect 301 but on the new domain Google indexes ?m=1 as in the image bellow
and when I try to inspect the same link by myself without ?m=1 I get Discovered - currently not indexed
thanks in advance
?m=1 added in permalink when you load a page from mobile device. You cannot remove ?m=1 , but you can hide it using javascript code
Add Following code in section of your template :
<script type='text/javascript'>
<!-- Code From narendradwivedi.org -->
//<![CDATA[
var uri = window.location.toString();
if (uri.indexOf("%3D","%3D") > 0) {
var clean_uri = uri.substring(0, uri.indexOf("%3D"));
window.history.replaceState({}, document.title, clean_uri);
}
var uri = window.location.toString();
if (uri.indexOf("%3D%3D","%3D%3D") > 0) {
var clean_uri = uri.substring(0, uri.indexOf("%3D%3D"));
window.history.replaceState({}, document.title, clean_uri);
}
var uri = window.location.toString();
if (uri.indexOf("&m=1","&m=1") > 0) {
var clean_uri = uri.substring(0, uri.indexOf("&m=1"));
window.history.replaceState({}, document.title, clean_uri);
}
var uri = window.location.toString();
if (uri.indexOf("?m=1","?m=1") > 0) {
var clean_uri = uri.substring(0, uri.indexOf("?m=1"));
window.history.replaceState({}, document.title, clean_uri);
}
//]]>
</script>
When you are submitting url in google search console, make sure to remove ?m=1
Discovered - Currently not indexed means google know that url but due to duplicate content / copy paste posts , not allowing to index the page. Sometime google consider your post as less important , so you get discovered - currently not indexed in search console. Try resubmitting those posts again after your site have some good quality posts.
Reference : Narendra Dwivedi - Remove ?m=1 From URL

How to update the snippet.description on Youtube from Google Apps Script API using only the videoId?

I want to update my snippet.description on my Youtube channel using the API exposed through Google Apps Script. I know the videoId already so there is no need to create and loop through a search list like they show in the example here.
I expect to see my script complete with the new description on my Youtube video. But I get the following error message instead.
API call to youtube.videos.update failed with error: Forbidden (line 90, file "Youtube")
Code.gs
function updateVideo( data ) {
var videoId = 'foo';
var title = 'bar';
var description = 'baz';
var resource = {
id: videoId,
snippet: {
title: title,
description: description,
categoryId: '22'
}
};
YouTube.Videos.update(resource, 'id,snippet'); // this is line 90
}
What am I doing wrong?
Note
To clarify: By "only the videoId", I mean without creating a list of channels to find it like they do here.
var myChannels = YouTube.Channels.list('contentDetails', {mine: true});
Edit
This question is different because the other asks specifically about HTML. This question is not about using HTML in the description. It's about making any changes whatsoever to the description.
Summary from comments:
This is an authorization error. The account making the API request was not the same account as the owner of the YouTube video.

Google place Api PlaceDetails Photo Reference

I am using Google Place Api where is on some results "photo_reference" (similar to "reference") value. I cannot find any mention about that how to use it to get that photo. I know how to use "reference" to get PlaceDetail and I am sure that usage of photo_reference will be similar, but I cannot find JSON/XML URL for this photo_reference request. Thank you for any help. Pavel
Please take a look at documentation here: https://developers.google.com/places/documentation/photos
They've just announced this new Place Photos feature
In short this is how you should use this new feature:
https://maps.googleapis.com/maps/api/place/photo?photoreference=PHOTO_REFERENCE&sensor=false&maxheight=MAX_HEIGHT&maxwidth=MAX_WIDTH&key=YOUR_API_KEY
just substitute your own values in place of:
PHOTO_REFERENCE
MAX_HEIGHT - int value from 1 to 1600
MAX_WIDTH - int value from 1 to 1600
YOUR_API_KEY
and you are done
The Places API now supports the return of one place photo if available for a Place Search request and up to ten place photos for a Place Details request.
If a photos array is returned with your request, you can pass the photo_reference from a contained photo object to a Place Photo request with the maxheight and/or maxwidth, sensor and key parameters:
https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=CnRvAAAAwMpdHeWlXl-lH0vp7lez4znKPIWSWvgvZFISdKx45AwJVP1Qp37YOrH7sqHMJ8C-vBDC546decipPHchJhHZL94RcTUfPa1jWzo-rSHaTlbNtjh-N68RkcToUCuY9v2HNpo5mziqkir37WU8FJEqVBIQ4k938TI3e7bf8xq-uwDZcxoUbO_ZJzPxremiQurAYzCTwRhE_V0&sensor=false&key=AddYourOwnKeyHere
Please see the documentation for more details.
please bear in mind that there are no free photo requests anymore.
At this moment (November 2020), it is $7.0 for 1000 requests (if your volume is up to 100,000). Check the photo below.
Read more on Google Places billing info page.
Step 1: The URL you should use to call Google Place Photos is :
String url = https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=PHOTOREF&key=YOUR_API_KEY
Refer: https://developers.google.com/places/web-service/photos
Step 2: Since the above URL redirects to another URL, use HTTPClient, as it automatically handles redirect stuff.
Code:
DefaultHttpClient hc = new DefaultHttpClient();
HttpGet httpget = new HttpGet(url);
HttpContext context = new BasicHttpContext();
hc.setRedirectHandler(new DefaultRedirectHandler() {
#Override
public URI getLocationURI(HttpResponse response,
HttpContext context) throws org.apache.http.ProtocolException {
//Capture the Location header here - This is your redirected URL
System.out.println(Arrays.toString(response.getHeaders("Location")));
return super.getLocationURI(response,context);
}
});
// Response contains the image you want. If you test the redirect URL in a browser or REST CLIENT you can see it's data
HttpResponse response = hc.execute(httpget, context);
if(response.getStatusLine().getStatusCode() == 200) {
// Todo: use the Image response
HttpEntity entity = response.getEntity();
if (entity != null) {
InputStream instream = entity.getContent();
Bitmap bmp = BitmapFactory.decodeStream(instream);
ImageView imageView = new ImageView(context);
imageView.setImageBitmap(bmp);
images.add(imageView);
instream.close();
}
}
else {
System.out.println(response.getStatusLine().getStatusCode()+"");
}
Hope this helps everyone.
After initiating map you can get place details with it's images
const service = new window.google.maps.places.PlacesService(map);
service.getDetails(
{
placeId: "some_place_id_here"
},
(data, status) => {
if (status === window.google.maps.places.PlacesServiceStatus.OK) {
data.photos &&
data.photos.forEach(photo => {
console.log(photo.getUrl({ maxWidth: 500, maxHeight: 500 }));
});
}
}
);
Solving the PhotoReference issue for Javascript
User #R.K solved this issue in java, however in js you need to use fetch(). Here's the code I used:
await fetch(proxyUrl+url).then(async(ref)=>{
await ref.blob()}).then((image)=>{
// do what you need to do
console.log(image)
}).catch((err)=>{
console.log(err);
})
In this, I used a heroku link for the proxyUrl and the url shown in #Chriss Green's post for url. Hope this helps anyone confused using js!

Enable HTML Tags in PHPBB [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
Im trying to find a way to enable HTML Tags in PHPBB (only for administrations).
do you know how can I achieve this?
Thanks
This is not supported out of the box. You should use custom BBCodes instead. If you really, really insist on HTML tags, you can use the Enable HTML MOD.
Lately I was busy porting Snitz 2.x based forum to phpbb3 forum.
The main challenge I had to deal with was around HTML support in the post body.
Snitz allowed HTML inside the post body but phpbb3 forbids HTML tags inside the post.
Since we have ~40000 posts that many of them contains HTML tags we had to find a solution for this.
Here it is: we used Enable HTML MOD but we modify it.
The original function:
function enable_html($text, $uid)
{
if (strpos($text, '[html') === false)
{
return $text;
}
$text = str_replace(array('[html:' . $uid . ']', '[/html:' . $uid . ']'), array('[html]', '[/html]'), $text);
$text_ary = explode('[html]', $text);
$text = '';
foreach ($text_ary as $tmp)
{
if (strpos($tmp, '[/html]'))
{
$tmp = explode('[/html]', $tmp, 2);
$text .= htmlspecialchars_decode(str_replace(array("\r\n", "\n"), ' ', $tmp[0])) . $tmp[1];
}
else
{
$text .= $tmp;
}
}
return str_replace(array('[html]', '[/html]'), '', $text);
}
was modified to
function enable_html($text, $uid)
{
return htmlspecialchars_decode($text);
}
The last step was to give the new permission to the users and we got the HTML rendered as we had it in Snitz.