Title: | Client for 'TGStat API' |
---|---|
Description: | Allow function for using 'TGStat Stat API' and 'TGStat Search API', for more details see <https://api.tgstat.ru/docs/ru/start/intro.html>. 'TGStat' provide telegram channel analytics data. |
Authors: | Alexey Seleznev [aut, cre] |
Maintainer: | Alexey Seleznev <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.3.4 |
Built: | 2024-10-26 03:38:25 UTC |
Source: | CRAN |
Allow function for using 'TGStat Stat API' and 'TGStat Search API', for more details see https://api.tgstat.ru/docs/ru/start/intro.html. 'TGStat' provide telegram channel analytics data.
Maintainer: Alexey Seleznev [email protected] (ORCID)
Useful links:
API request statistics
tg_api_usage()
tg_api_usage()
tibble with API quote stat
Set API Token of 'TgStat'
tg_auth(token)
tg_auth(token)
token |
Your API token. |
Use only for set token. No return value.
See also TGStat API Documentation of Authorization
List of 'TGStat' channel categories
tg_categories(lang = NULL)
tg_categories(lang = NULL)
lang |
Response language |
tibble with categories
See also TGStat API Documentation of metrod database/categories
Get general information about the channel - link to the channel, name, description, avatar, number of subscribers at the moment.
tg_channel(channel_id = tg_get_channel_id())
tg_channel(channel_id = tg_get_channel_id())
channel_id |
hannel ID (@username, t.me/username, t.me/joinchat/AAAAABbbbbcccc ... or channel ID in 'TGStat') |
tibble with channel metadata
See also TGStat API Documentation of metrod channels/get
## Not run: channel <- tg_channel(channel_id = "R4marketing") ## End(Not run)
## Not run: channel <- tg_channel(channel_id = "R4marketing") ## End(Not run)
Allows you to get the indicator "average coverage of publications" in dynamics by days, weeks, months.
tg_channel_avg_posts_reach( channel_id = tg_get_channel_id(), start_date = Sys.Date() - 15, end_date = Sys.Date(), group = c("day", "week", "month") )
tg_channel_avg_posts_reach( channel_id = tg_get_channel_id(), start_date = Sys.Date() - 15, end_date = Sys.Date(), group = c("day", "week", "month") )
channel_id |
Channel ID (@username, t.me/username, t.me/joinchat/AAAAABbbbbcccc ... or channel ID in 'TGStat') |
start_date |
Start date of report period |
end_date |
End date of report period |
group |
Time group: day, week, month |
For the group = 'day'
grouping, the value for the "average coverage of publications" as of the end of the day will be returned.
For groupings group = 'week'
and group = 'month'
, the value of the indicator "average coverage of publications" at the end of the last day of the period (week or month) will be returned.
By default, the result will be returned for the last 10 days. However, you can specify the required period using the start_date
and end_date
parameters, while observing the restrictions on your tariff.
Depending on the requested grouping type group - the period
field will take one of the following formats:
day: Y-m-d
week: Y-W
month: Y-m
tibble with post reach dinamics
See also TGStat API Documentation of metrod channels/avg-posts-reach
## Not run: tg_set_channel_id('R4marketing') post_reach <- tg_channel_avg_posts_reach() ## End(Not run)
## Not run: tg_set_channel_id('R4marketing') post_reach <- tg_channel_avg_posts_reach() ## End(Not run)
Allows you to get the "ERR" indicator in dynamics by day, week, month.
tg_channel_err( channel_id = tg_get_channel_id(), start_date = Sys.Date() - 15, end_date = Sys.Date(), group = c("day", "week", "month") )
tg_channel_err( channel_id = tg_get_channel_id(), start_date = Sys.Date() - 15, end_date = Sys.Date(), group = c("day", "week", "month") )
channel_id |
Channel ID (@username, t.me/username, t.me/joinchat/AAAAABbbbbcccc ... or channel ID in 'TGStat') |
start_date |
Start date of report period |
end_date |
End date of report period |
group |
Time group: day, week, month |
For the group = 'day'
grouping, the value for the "average coverage of publications" as of the end of the day will be returned.
For groupings group = 'week'
and group = 'month'
, the value of the indicator "average coverage of publications" at the end of the last day of the period (week or month) will be returned.
By default, the result will be returned for the last 10 days. However, you can specify the required period using the start_date
and end_date
parameters, while observing the restrictions on your tariff.
Depending on the requested grouping type group - the period
field will take one of the following formats:
day: Y-m-d
week: Y-W
month: Y-m
tibble with channel ERR dinamics
See also TGStat API Documentation of metrod channels/err
## Not run: tg_set_channel_id('R4marketing') err <- tg_channel_err() ## End(Not run)
## Not run: tg_set_channel_id('R4marketing') err <- tg_channel_err() ## End(Not run)
Allows you to get a list of reposts of publications from a channel to other channels.
tg_channel_forwards( channel_id = tg_get_channel_id(), start_date = Sys.Date() - 15, end_date = Sys.Date() )
tg_channel_forwards( channel_id = tg_get_channel_id(), start_date = Sys.Date() - 15, end_date = Sys.Date() )
channel_id |
Channel ID (@username, t.me/username, t.me/joinchat/AAAAABbbbbcccc ... or channel ID in 'TGStat') |
start_date |
Date forwards from |
end_date |
Date forwards to |
tibble with forwards
See also TGStat API Documentation of metrod channels/forwards
## Not run: forwards <- tg_channel_forwards( channel_id = 'R4marketing', start_date = '2021-01-01', end_date = '2021-09-30' ) ## End(Not run)
## Not run: forwards <- tg_channel_forwards( channel_id = 'R4marketing', start_date = '2021-01-01', end_date = '2021-09-30' ) ## End(Not run)
The method allows you to get a list of mentions of a channel in other channels.
tg_channel_mentions( channel_id = tg_get_channel_id(), start_date = Sys.Date() - 15, end_date = Sys.Date() )
tg_channel_mentions( channel_id = tg_get_channel_id(), start_date = Sys.Date() - 15, end_date = Sys.Date() )
channel_id |
Channel ID (@username, t.me/username, t.me/joinchat/AAAAABbbbbcccc ... or channel ID in 'TGStat') |
start_date |
Date mentioned from |
end_date |
Date mentioned to |
A publication is considered a mention if it contains a link to a channel like username, t.me/username, t.me/username/1234.
In case of mentioning a channel, the mention_type
parameter will contain the value 'channel'. If a specific publication of the channel is mentioned, then the parameter will contain the value 'post'.
tibble with mention data
See also TGStat API Documentation of metrod channels/mentions
## Not run: mentions <- tg_channel_mentions( channel_id = 'R4marketing', start_date = '2021-10-01', end_date = '2021-10-31' ) ## End(Not run)
## Not run: mentions <- tg_channel_mentions( channel_id = 'R4marketing', start_date = '2021-10-01', end_date = '2021-10-31' ) ## End(Not run)
The method allows you to get channel publications according to the specified parameters. Returns channel messages sorted in reverse chronological order (most recent from the top).
tg_channel_posts( channel_id = tg_get_channel_id(), start_time = Sys.Date() - 15, end_time = Sys.Date(), hide_forwards = 0, hide_deleted = 0 )
tg_channel_posts( channel_id = tg_get_channel_id(), start_time = Sys.Date() - 15, end_time = Sys.Date(), hide_forwards = 0, hide_deleted = 0 )
channel_id |
Channel ID (@username, t.me/username, t.me/joinchat/AAAAABbbbbcccc ... or channel ID in 'TGStat') |
start_time |
Date of publication from |
end_time |
Date of publication to |
hide_forwards |
Hide reposts from search results |
hide_deleted |
Hide deleted posts |
tibble with channel posts
See also TGStat API Documentation of metrod channels/posts
## Not run: posts <- tg_channel_posts( channel_id = "R4marketing", start_time = "2021-11-01 00:00:00", end_time = "2021-11-30 23:59:59" ) ## End(Not run)
## Not run: posts <- tg_channel_posts( channel_id = "R4marketing", start_time = "2021-11-01 00:00:00", end_time = "2021-11-30 23:59:59" ) ## End(Not run)
The method allows you to obtain basic statistics - the number of participants, the average coverage of the publication, the percentage of engagement of subscribers (ERR), the total daily coverage, the citation index (CI)
tg_channel_stat(channel_id = tg_get_channel_id())
tg_channel_stat(channel_id = tg_get_channel_id())
channel_id |
Channel ID (@username, t.me/username, t.me/joinchat/AAAAABbbbbcccc ... or channel ID in 'TGStat') |
tibble with channel stat
See also TGStat API Documentation of metrod channels/stat
## Not run: channel_stat <- tg_channel_stat(channel_id = "R4marketing") ## End(Not run)
## Not run: channel_stat <- tg_channel_stat(channel_id = "R4marketing") ## End(Not run)
The method allows you to get the number of channel subscribers in dynamics by hours, days, weeks, months.
tg_channel_subscribers( channel_id = tg_get_channel_id(), start_date = Sys.Date() - 15, end_date = Sys.Date(), group = c("day", "hour", "week", "month") )
tg_channel_subscribers( channel_id = tg_get_channel_id(), start_date = Sys.Date() - 15, end_date = Sys.Date(), group = c("day", "hour", "week", "month") )
channel_id |
Channel ID (@username, t.me/username, t.me/joinchat/AAAAABbbbbcccc ... or channel ID in 'TGStat') |
start_date |
Start date of report period |
end_date |
End date of report period |
group |
Time group: hour, day, week, month |
For grouping group = day, the number of subscribers as of the end of the day will be returned.
For groupings group = week and group = month, the number of subscribers at the end of the last day of the period (week or month) will be returned.
Depending on the requested grouping type group - the period field will take one of the following formats:
hour: Y-m-d H:00
day: Y-m-d
week: Y-W
month: Y-m
tibble with subscribers stat
See also TGStat API Documentation of metrod channels/subscribers
## Not run: channel_subscribers <- tg_channel_subscribers( channel_id = "R4marketing", start_date = "2021-06-01", end_date = "2021-10-31", group = "month" ) ## End(Not run)
## Not run: channel_subscribers <- tg_channel_subscribers( channel_id = "R4marketing", start_date = "2021-06-01", end_date = "2021-10-31", group = "month" ) ## End(Not run)
Getting the number of views in dynamics
tg_channel_views( channel_id = tg_get_channel_id(), start_date = Sys.Date() - 15, end_date = Sys.Date(), group = c("day", "hour", "week", "month") )
tg_channel_views( channel_id = tg_get_channel_id(), start_date = Sys.Date() - 15, end_date = Sys.Date(), group = c("day", "hour", "week", "month") )
channel_id |
Channel ID (@username, t.me/username, t.me/joinchat/AAAAABbbbbcccc ... or channel ID in 'TGStat') |
start_date |
Start date of report period |
end_date |
End date of report period |
group |
Time group: hour, day, week, month |
The method allows you to get the total number of views per day on the channel, in dynamics by days, weeks, months.
tibble with channel views
## Not run: tg_auth('Your token') tg_set_channel_id('R4marketing') views <- tg_channel_views( start_date = '2021-09-01', end_date = '2021-09-30', group = "day" ) ## End(Not run)
## Not run: tg_auth('Your token') tg_set_channel_id('R4marketing') views <- tg_channel_views( start_date = '2021-09-01', end_date = '2021-09-30', group = "day" ) ## End(Not run)
The method allows you to search for channels by keyword or get a list of channels in a category.
tg_channels_search( query = NULL, search_by_description = FALSE, country = "ru", language = "russian", category = NULL, limit = 100 )
tg_channels_search( query = NULL, search_by_description = FALSE, country = "ru", language = "russian", category = NULL, limit = 100 )
query |
Search keyword |
search_by_description |
Search in channel description? |
country |
Channel geography (country). Use |
language |
Channel content language. Use |
category |
Channel category. Use |
limit |
Maximum number of channels in a response, no more than 100. |
tibble with channels
See also TGStat API Documentation of metrod channels/search
## Not run: channels <- tg_channels_search( query = "data", country = "ru", category = "tech" ) ## End(Not run)
## Not run: channels <- tg_channels_search( query = "data", country = "ru", category = "tech" ) ## End(Not run)
List of countries 'TGStat'
tg_countries(lang = NULL)
tg_countries(lang = NULL)
lang |
Response language |
tibble with countries
See also TGStat API Documentation of metrod database/countries
Get defaukt channel ID
tg_get_channel_id()
tg_get_channel_id()
character, default session channel id
Get API Token of 'TgStat'
tg_get_token()
tg_get_token()
Api token
List of available languages for 'TGStat' channels
tg_languages(lang = NULL)
tg_languages(lang = NULL)
lang |
Response language |
tibble
See also TGStat API Documentation of metrod database/languages
A method for obtaining data on the mentions of a keyword / phrase grouped by channel. Suitable for tracking channels that often write on a given topic, mention a brand or person in Telegram publications. Returns information about the channel, the number of mentions, reach, and the date of the last mention of the keyword in the channel.
tg_mentions_by_channels( query, peer_type = c("all", "channel", "chat"), start_date = Sys.Date() - 15, end_date = Sys.Date(), hide_forwards = 0, strong_search = 0, minus_mords = NULL, extended_syntax = 0 )
tg_mentions_by_channels( query, peer_type = c("all", "channel", "chat"), start_date = Sys.Date() - 15, end_date = Sys.Date(), hide_forwards = 0, strong_search = 0, minus_mords = NULL, extended_syntax = 0 )
query |
Search query |
peer_type |
Source type (channel, chat, all) |
start_date |
Published date from (timestamp) |
end_date |
Date published to (timestamp) |
hide_forwards |
Hide reposts from search results |
strong_search |
Enable strict search (disables morphology and search by part of a word) |
minus_mords |
List of negative words (separator - space) |
extended_syntax |
Whether the request uses extended query syntax, see details |
Keyword / phrase search methods support extended query syntax. You must pass the extendedSyntax parameter (or extended_syntax in newer API methods) to indicate to the parser that the search query contains statements from the extended query language.
Morphology:
Regardless of the form in which you used a word in a query, by default all its morphological forms are taken into account (in any case, singular and plural). That is, by request mom will also find publications in which mom, mom, mom, mom, etc. are found.
To change this behavior, you must use the =
operator.
Exact occurrence of the word. Operator =
The =
operator in front of a word tells the analyzer that the given word should be searched for in an exact match with the transmitted one. The query =mom
will only find posts with the word mom. Publications containing the words mum, mum, mum, mum in the text will NOT be found.
Search by multiple words
When transferring several words separated by spaces to a search query, publications will be found in which each of these words occurs at the same time. The request mom dad will find publications in the text of which both of these words appear simultaneously in any order and case, at any distance from each other.
OR operator |
If you need to find publications in which at least one of the words occurs, you must use the OR operator |
.
Request Mom | dad
will find publications in the text of which at least one of these words is found.
Search for a phrase. Operator ""
The query mama washed the frame
, enclosed in double quotes, sets a strict word order, explaining to the analyzer that it needs to find the entire phrase passed. Only those publications will be found in which these three words appear side by side in the same order as specified in the request.
Publications containing these words in word forms other than those submitted will also be found. To change this behavior, you must use the =
operator.
The query = "mama soap frame"
will only find publications in which these three words appear side by side in the same order and in the same case as indicated in the query.
Using negative keywords. Operator -
Using the operator -
you can specify which words should not appear in the text of the publication. The query "mama soap" -frame
will show publications that contain the phrases mummy soap, mummy washed, ..., but do not contain the words frame, frame, etc.
Grouping words. Operator ()
Using parentheses in a search query allows you to group parts of a query and make more complex combinations using the operators described above.
The query (mom | dad | brother | sister)
(soap | painted)
(frame | door)
will find publications in the text of which at least one word from each word group is necessarily found. Those. publications will be found containing: mom washed the frame, dad washed the frame, sister painted the door, etc.
The query (mom | dad) (dyed) - (frame | door | hair)
will find publications, the text of which must contain at least one of the words of the first group mom, dad, it must contain a word from the second group painted, dyed, dyed, but not contains words from the last group frame, door, hair.
You can practice writing search queries in our publication search tool (do not forget to check the "Advanced language" checkbox to enable the advanced query syntax mode).
list
See also TGStat API Documentation of metrod words/mentions-by-period
## Not run: mentions_data <- tg_mentions_by_channels( query = 'Alexey Seleznev', start_date = '2021-09-01', end_date = '2021-09-30' ) mentions <- mentions_data$items channels <- mentions_data$channels ## End(Not run)
## Not run: mentions_data <- tg_mentions_by_channels( query = 'Alexey Seleznev', start_date = '2021-09-01', end_date = '2021-09-30' ) mentions <- mentions_data$items channels <- mentions_data$channels ## End(Not run)
A method to track the dynamics of mentions and reach of keywords or phrases. Suitable for monitoring the mention of a brand or person in Telegram publications. Returns the number of mentions and reach of a keyword for each day of the requested period.
tg_mentions_by_period( query, peer_type = c("all", "channel", "chat"), start_date = Sys.Date() - 15, end_date = Sys.Date(), group = c("day", "week", "month"), hide_forwards = 0, strong_search = 0, minus_mords = NULL, extended_syntax = 0 )
tg_mentions_by_period( query, peer_type = c("all", "channel", "chat"), start_date = Sys.Date() - 15, end_date = Sys.Date(), group = c("day", "week", "month"), hide_forwards = 0, strong_search = 0, minus_mords = NULL, extended_syntax = 0 )
query |
Search query |
peer_type |
Source type (channel, chat, all) |
start_date |
Published date from (timestamp) |
end_date |
Date published to (timestamp) |
group |
Time group: day, week, month |
hide_forwards |
Hide reposts from search results |
strong_search |
Enable strict search (disables morphology and search by part of a word) |
minus_mords |
List of negative words (separator - space) |
extended_syntax |
Whether the request uses extended query syntax, see details |
Keyword / phrase search methods support extended query syntax. You must pass the extendedSyntax parameter (or extended_syntax in newer API methods) to indicate to the parser that the search query contains statements from the extended query language.
Morphology:
Regardless of the form in which you used a word in a query, by default all its morphological forms are taken into account (in any case, singular and plural). That is, by request mom will also find publications in which mom, mom, mom, mom, etc. are found.
To change this behavior, you must use the =
operator.
Exact occurrence of the word. Operator =
The =
operator in front of a word tells the analyzer that the given word should be searched for in an exact match with the transmitted one. The query =mom
will only find posts with the word mom. Publications containing the words mum, mum, mum, mum in the text will NOT be found.
Search by multiple words
When transferring several words separated by spaces to a search query, publications will be found in which each of these words occurs at the same time. The request mom dad will find publications in the text of which both of these words appear simultaneously in any order and case, at any distance from each other.
OR operator |
If you need to find publications in which at least one of the words occurs, you must use the OR operator |
.
Request Mom | dad
will find publications in the text of which at least one of these words is found.
Search for a phrase. Operator ""
The query mama washed the frame
, enclosed in double quotes, sets a strict word order, explaining to the analyzer that it needs to find the entire phrase passed. Only those publications will be found in which these three words appear side by side in the same order as specified in the request.
Publications containing these words in word forms other than those submitted will also be found. To change this behavior, you must use the =
operator.
The query = "mama soap frame"
will only find publications in which these three words appear side by side in the same order and in the same case as indicated in the query.
Using negative keywords. Operator -
Using the operator -
you can specify which words should not appear in the text of the publication. The query "mama soap" -frame
will show publications that contain the phrases mummy soap, mummy washed, ..., but do not contain the words frame, frame, etc.
Grouping words. Operator ()
Using parentheses in a search query allows you to group parts of a query and make more complex combinations using the operators described above.
The query (mom | dad | brother | sister)
(soap | painted)
(frame | door)
will find publications in the text of which at least one word from each word group is necessarily found. Those. publications will be found containing: mom washed the frame, dad washed the frame, sister painted the door, etc.
The query (mom | dad) (dyed) - (frame | door | hair)
will find publications, the text of which must contain at least one of the words of the first group mom, dad, it must contain a word from the second group painted, dyed, dyed, but not contains words from the last group frame, door, hair.
You can practice writing search queries in our publication search tool (do not forget to check the "Advanced language" checkbox to enable the advanced query syntax mode).
tibble with mention statistics
See also TGStat API Documentation of metrod words/mentions-by-period
## Not run: mentions <- tg_mentions_by_period( query = 'Alexey Seleznev', start_date = '2021-09-01', end_date = '2021-09-30' ) ## End(Not run)
## Not run: mentions <- tg_mentions_by_period( query = 'Alexey Seleznev', start_date = '2021-09-01', end_date = '2021-09-30' ) ## End(Not run)
Get rtgstat option values
tg_options()
tg_options()
no return data, using for side effect
Retrieving publication data
tg_post(post_id)
tg_post(post_id)
post_id |
Post ID (t.me/username/123, t.me/c/1256804429/1230 or post ID in TGStat) |
Get information and publications in Telegram - number of views, publication date, content, ...
tibble with post data
See also TGStat API Documentation of metrod posts/get
## Not run: post <- tg_post( post_id = 'https://t.me/R4marketing/887' ) ## End(Not run)
## Not run: post <- tg_post( post_id = 'https://t.me/R4marketing/887' ) ## End(Not run)
Getting publication statistics
tg_post_stat(post_id, group = c("day", "hour"))
tg_post_stat(post_id, group = c("day", "hour"))
post_id |
Post ID (t.me/username/123, t.me/c/1256804429/1230 or post ID in TGStat) |
group |
Grouping results (hour, day) |
Obtaining publication statistics - the number of views at the moment, the list of reposts and mentions, the dynamics of the growth of views by hours / days.
list with tibbles
See also TGStat API Documentation of metrod posts/stat
## Not run: post_stat <- tg_post_stat( post_id = 'https://t.me/R4marketing/887', group = 'day' ) views <- post_stat$views forwards <- post_stat$forwards mentions <- post_stat$mentions ## End(Not run)
## Not run: post_stat <- tg_post_stat( post_id = 'https://t.me/R4marketing/887', group = 'day' ) views <- post_stat$views forwards <- post_stat$forwards mentions <- post_stat$mentions ## End(Not run)
Method for searching publications by keyword. Returns publications, sorted in reverse chronological order (most recent from the top), in which the search text was found.
tg_posts_search( query, peer_type = c("all", "channel", "chat"), start_date = Sys.Date() - 15, end_date = Sys.Date(), hide_forwards = 0, hide_deleted = 0, strong_search = 0, minus_mords = NULL, extended_syntax = 0 )
tg_posts_search( query, peer_type = c("all", "channel", "chat"), start_date = Sys.Date() - 15, end_date = Sys.Date(), hide_forwards = 0, hide_deleted = 0, strong_search = 0, minus_mords = NULL, extended_syntax = 0 )
query |
Search query |
peer_type |
Source type (channel, chat, all) |
start_date |
Published date from (timestamp) |
end_date |
Date published to (timestamp) |
hide_forwards |
Hide reposts from search results |
hide_deleted |
Hide deleted posts |
strong_search |
Enable strict search (disables morphology and search by part of a word) |
minus_mords |
List of negative words (separator - space) |
extended_syntax |
Whether the request uses extended query syntax, see details |
Keyword / phrase search methods support extended query syntax. You must pass the extendedSyntax parameter (or extended_syntax in newer API methods) to indicate to the parser that the search query contains statements from the extended query language.
Morphology:
Regardless of the form in which you used a word in a query, by default all its morphological forms are taken into account (in any case, singular and plural). That is, by request mom will also find publications in which mom, mom, mom, mom, etc. are found.
To change this behavior, you must use the =
operator.
Exact occurrence of the word. Operator =
The =
operator in front of a word tells the analyzer that the given word should be searched for in an exact match with the transmitted one. The query =mom
will only find posts with the word mom. Publications containing the words mum, mum, mum, mum in the text will NOT be found.
Search by multiple words
When transferring several words separated by spaces to a search query, publications will be found in which each of these words occurs at the same time. The request mom dad will find publications in the text of which both of these words appear simultaneously in any order and case, at any distance from each other.
OR operator |
If you need to find publications in which at least one of the words occurs, you must use the OR operator |
.
Request Mom | dad
will find publications in the text of which at least one of these words is found.
Search for a phrase. Operator ""
The query mama washed the frame
, enclosed in double quotes, sets a strict word order, explaining to the analyzer that it needs to find the entire phrase passed. Only those publications will be found in which these three words appear side by side in the same order as specified in the request.
Publications containing these words in word forms other than those submitted will also be found. To change this behavior, you must use the =
operator.
The query = "mama soap frame"
will only find publications in which these three words appear side by side in the same order and in the same case as indicated in the query.
Using negative keywords. Operator -
Using the operator -
you can specify which words should not appear in the text of the publication. The query "mama soap" -frame
will show publications that contain the phrases mummy soap, mummy washed, ..., but do not contain the words frame, frame, etc.
Grouping words. Operator ()
Using parentheses in a search query allows you to group parts of a query and make more complex combinations using the operators described above.
The query (mom | dad | brother | sister)
(soap | painted)
(frame | door)
will find publications in the text of which at least one word from each word group is necessarily found. Those. publications will be found containing: mom washed the frame, dad washed the frame, sister painted the door, etc.
The query (mom | dad) (dyed) - (frame | door | hair)
will find publications, the text of which must contain at least one of the words of the first group mom, dad, it must contain a word from the second group painted, dyed, dyed, but not contains words from the last group frame, door, hair.
You can practice writing search queries in our publication search tool (do not forget to check the "Advanced language" checkbox to enable the advanced query syntax mode).
list with two tibbles
## Not run: post_search <- tg_posts_search( query = 'rtgstat package', peer_type = 'channel', start_date = '2021-11-01', end_date = '2021-11-31' ) search_result <- post_search$items channels <- post_search$channels ## End(Not run)
## Not run: post_search <- tg_posts_search( query = 'rtgstat package', peer_type = 'channel', start_date = '2021-11-01', end_date = '2021-11-31' ) search_result <- post_search$items channels <- post_search$channels ## End(Not run)
Set API limit alert rate
tg_set_api_quote_alert_rate(api_quote_alert_rate)
tg_set_api_quote_alert_rate(api_quote_alert_rate)
api_quote_alert_rate |
Max reach of API limit to alert |
using for side effect, no returm value
Set session default channel id
tg_set_channel_id(channel_id)
tg_set_channel_id(channel_id)
channel_id |
Channel ID (@username, t.me/username, t.me/joinchat/AAAAABbbbbcccc ... or channel ID in 'TGStat') |
Using for side effect, no return data
## Not run: tg_set_channel_id('R4marketing') stat <- tg_channel_stat() ## End(Not run)
## Not run: tg_set_channel_id('R4marketing') stat <- tg_channel_stat() ## End(Not run)
Disable or enable API limit alert
tg_set_check_api_quote(check_api_quote)
tg_set_check_api_quote(check_api_quote)
check_api_quote |
Logical, disable (or enable) API limit alerts |
using for side effect, no return value
Set time interval in seconds between tries of HTTP queries
tg_set_interval(interval)
tg_set_interval(interval)
interval |
delay between retries |
using for side effect, no return value
Set max tries of HTTP queries
tg_set_max_tries(max_tries)
tg_set_max_tries(max_tries)
max_tries |
integer, maximum number of attempts |
using for side effect, no returm value