Skip to content

bodasooqa/upwork-rss-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Upwork Scrapper

This JavaScript code is a script for a Telegram bot that fetches data from an Upwork RSS feed and sends it to a specified Telegram chat. The script uses several libraries, including node-telegram-bot-api for interacting with the Telegram API, rss-parser for parsing the RSS feed, and lowdb/node for a lightweight JSON database.

The script begins by importing the necessary modules and initializing some constants. The dotenv/config import is used to load environment variables from a .env file. These variables include the URL for the Upwork RSS feed, the query parameters for the feed, and the authentication tokens for both Upwork and Telegram.

The TelegramBot object is initialized with the bot token from the environment variables and set to polling mode. This means the bot will continuously check for new updates (like messages or commands) from the Telegram server.

The bot is set up to respond to the /start command. When a user sends this command, the bot will reply with a greeting message.

The checkForNewLinks function is an asynchronous function that fetches and parses the RSS feed from the Upwork URL. It then iterates over each item in the feed. If the link of an item is not already in the database, it logs the link, adds it to the database, and sends a message to the specified Telegram chat with the item's title and content. The content is formatted to replace certain HTML tags with newline characters and to remove excessive spaces.

The code ends abruptly, so it's likely there's more code following this that handles calling the checkForNewLinks function and managing the database updates.

Usage

First of all:

  1. Create telegram bot via @BotFather
  2. Get RSS link with your parameters in query (q, securityToken, userUid, orgUid)

Install dependencies:

yarn install

Create .env and set values for ENV variables:

TELEGRAM_BOT_TOKEN=''
TELEGRAM_CHAT_ID=''

UPWORK_URL='https://www.upwork.com/ab/feed/jobs/rss'
UPWORK_QUERY='(typescript+OR+vue)'
UPWORK_SEQURITY_TOKEN=''
UPWORK_USER_UID=''
UPWORK_ORG_UID=''

Run script:

yarn start

Preview

preview

About

The script parses Upwork RSS for new jobs and sends them to you in Telegram using the bot

Topics

Resources

Stars

Watchers

Forks