Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to select "News" only in Sources? #12

Closed
salshyn opened this issue Aug 30, 2018 · 3 comments
Closed

How to select "News" only in Sources? #12

salshyn opened this issue Aug 30, 2018 · 3 comments

Comments

@salshyn
Copy link

salshyn commented Aug 30, 2018

Just News, nothing else.

Can't guess:

sources: [null, [7], [1]],  
      // 11 newsweb, 12 blogweb, 13 newsblogs, 14 null, 21 newsweb, 22 blogweb, 23 newsblogs,
      // 31 newsweb, 
      // 3 newsblogsweb, 1 newsblogsweb,
      // 01 undefined
      // 111 newsweb, 101 undefined, 112 newsweb, 156 newsblogsweb
      // 81 finance,news,web
      // 71 discussions,news,web
@salshyn
Copy link
Author

salshyn commented Aug 31, 2018

@adasq

@adasq
Copy link
Owner

adasq commented Aug 31, 2018 via email

@adasq
Copy link
Owner

adasq commented Sep 1, 2018

v0.3.0 published.

Here is an example, how to create alert with sources:
https://github.com/adasq/google-alerts-api#create-alert

Supported sources:
https://github.com/adasq/google-alerts-api#available-source-types

Your example:

alerts.sync(() => {
    const alertToCreate = {
    	howOften: HOW_OFTEN.AT_MOST_ONCE_A_DAY,
	sources: SOURCE_TYPE.NEWS,
        lang: 'en',
        name: 'NodeJS AND "Chrome V8"',
        region: 'PL', // or do not specify it at all, if you want "All Regions"
        howMany: HOW_MANY.BEST,
        deliverTo: DELIVER_TO.RSS,
        deliverToData: ''
    };

    alerts.create(alertToCreate, (err, alert) => {
        console.log(alert.sources === SOURCE_TYPE.NEWS);
    });
});

Tests with modification:
https://github.com/adasq/google-alerts-api/blob/v0.3.0/tests/test.js#L127-L149

Feel free to reopen the issue, if you have had any problem

@adasq adasq closed this as completed Sep 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants