mirror of
https://github.com/orangecoding/fredy.git
synced 2026-06-16 12:31:07 +00:00
Project-wide linting and formatting (#150)
* chore: configure project-wide linting and formatting * chore: run lint autofix and formatter
This commit is contained in:
4
.babelrc
4
.babelrc
@@ -3,9 +3,7 @@
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
"exclude": [
|
||||
"transform-regenerator"
|
||||
]
|
||||
"exclude": ["transform-regenerator"]
|
||||
}
|
||||
],
|
||||
[
|
||||
|
||||
3
.eslintignore
Normal file
3
.eslintignore
Normal file
@@ -0,0 +1,3 @@
|
||||
/ui/public
|
||||
/db/
|
||||
/conf/
|
||||
@@ -277,6 +277,5 @@ module.exports = {
|
||||
// Prevent passing of children as props
|
||||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-children-prop.md
|
||||
'react/no-children-prop': 'warn',
|
||||
|
||||
},
|
||||
};
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -4,7 +4,6 @@ about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
@@ -12,6 +11,7 @@ A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
|
||||
1
.github/ISSUE_TEMPLATE/feature_request.md
vendored
1
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -4,7 +4,6 @@ about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
|
||||
14
.github/workflows/stales.yml
vendored
14
.github/workflows/stales.yml
vendored
@@ -12,10 +12,10 @@ jobs:
|
||||
with:
|
||||
days-before-stale: 30
|
||||
days-before-close: 7
|
||||
stale-issue-message: "This issue has been automatically marked as stale due to inactivity."
|
||||
stale-pr-message: "This PR has been automatically marked as stale due to inactivity."
|
||||
close-issue-message: "Closing this issue due to prolonged inactivity."
|
||||
close-pr-message: "Closing this PR due to prolonged inactivity."
|
||||
exempt-issue-labels: "keep-open"
|
||||
exempt-pr-labels: "keep-open"
|
||||
only: "pulls"
|
||||
stale-issue-message: 'This issue has been automatically marked as stale due to inactivity.'
|
||||
stale-pr-message: 'This PR has been automatically marked as stale due to inactivity.'
|
||||
close-issue-message: 'Closing this issue due to prolonged inactivity.'
|
||||
close-pr-message: 'Closing this PR due to prolonged inactivity.'
|
||||
exempt-issue-labels: 'keep-open'
|
||||
exempt-pr-labels: 'keep-open'
|
||||
only: 'pulls'
|
||||
|
||||
6
.prettierignore
Normal file
6
.prettierignore
Normal file
@@ -0,0 +1,6 @@
|
||||
/ui/public
|
||||
/db/
|
||||
/conf/
|
||||
|
||||
# TODO re-write from scratch or fix all html structure issues
|
||||
/lib/notification/emailTemplate/template.hbs
|
||||
20
CHANGELOG.md
20
CHANGELOG.md
@@ -1,34 +1,42 @@
|
||||
Newer release changelog see https://github.com/orangecoding/fredy/releases
|
||||
|
||||
------------
|
||||
---
|
||||
|
||||
###### [V5.5.0]
|
||||
|
||||
- Upgrading dependencies
|
||||
- fixing provider
|
||||
- allow multiple instances of 1 provider
|
||||
- __BREAKING__: Minimum node version is now 16
|
||||
- **BREAKING**: Minimum node version is now 16
|
||||
|
||||
###### [V5.4.6]
|
||||
|
||||
- Adding Instana node.js monitoring
|
||||
-
|
||||
|
||||
###### [V5.4.5]
|
||||
|
||||
- Adding Instana node.js monitoring
|
||||
|
||||
###### [V5.4.4]
|
||||
|
||||
- Add support for Immo Südwest Presse (immo.swp.de)
|
||||
- Telegram: Use job name instead of ID and link in title
|
||||
- Fix race condition if user ID is in session but not in user store
|
||||
- Allow visiting the original provider URL
|
||||
|
||||
###### [V5.4.3]
|
||||
|
||||
- re-writing readme
|
||||
- improving docker build
|
||||
- using github's actions to build docker and test automatically
|
||||
|
||||
###### [V5.4.2]
|
||||
|
||||
- Fixing prod build
|
||||
|
||||
###### [V5.4.1]
|
||||
|
||||
- Upgrading dependencies
|
||||
- Provider urls are now automagically been changed to include the correct sort order for search results
|
||||
|
||||
@@ -39,36 +47,44 @@ results, thus cannot report them. This release fixes it by adding the necessary
|
||||
```
|
||||
|
||||
###### [V5.3.0]
|
||||
|
||||
- Upgrading dependencies
|
||||
- It's now possible to send mails to multiple receiver using comma separation for MailJet & Sendgrid
|
||||
- Fixing Immowelt scraping
|
||||
|
||||
###### [V5.2.0]
|
||||
|
||||
- Upgrading dependencies
|
||||
- Adding new similarity check layer (Duplicates are being removed now)
|
||||
- Adding paging for search results
|
||||
|
||||
###### [V5.1.0]
|
||||
|
||||
- Upgrading dependencies
|
||||
- NodeJS 12.13 is now the minimum supported version
|
||||
- Adding general settings as new configuration page to ui
|
||||
- Adding new feature working hours
|
||||
|
||||
###### [V5.0.0]
|
||||
|
||||
- Upgrading dependencies
|
||||
- NodeJS 12 is now the minimum supported version
|
||||
|
||||
###### [V4.0.0]
|
||||
|
||||
Bringing back Immoscout :tada:
|
||||
|
||||
###### [V3.0.0]
|
||||
|
||||
This is basically a re-write, your old config file will not be compatible anymore. Please re-created your search jobs
|
||||
on the new ui and use the values from your previous config file if needed.
|
||||
|
||||
```
|
||||
- We're getting rid of manual config changes, Fredy, now ships with a UI so that it's easy for you to create and edit jobs
|
||||
```
|
||||
|
||||
###### [V2.0.0]
|
||||
|
||||
```
|
||||
- Fredy can now run multiple search job on one instance
|
||||
- Changed lot's of the structure of Fredy to make this happen
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
If you want to contribute, please make sure you've executed the tests.
|
||||
|
||||
|
||||
### How to write new provider?
|
||||
|
||||
- create the provider filer under `/lib/provider`
|
||||
- create a test under /test and make sure it is running successfully
|
||||
|
||||
@@ -57,11 +57,10 @@ exports.metaInformation = {
|
||||
};
|
||||
|
||||
exports.config = config;
|
||||
|
||||
```
|
||||
|
||||
|
||||
### How to write new notification adapter?
|
||||
|
||||
- create the provider filer under `/lib/notification/adapter`
|
||||
- create a description of the provider under `/lib/notification/adapter/*.md`. Make sure the name of the md file is equal to the notification adapter
|
||||
|
||||
@@ -72,7 +71,6 @@ const Slack = require('slack');
|
||||
const msg = Slack.chat.postMessage;
|
||||
const { markdown2Html } = require('../../services/markdown');
|
||||
|
||||
|
||||
//as a parameter, you will always get the serviceName, newListings and all the values, that
|
||||
//you have defined exports.config.fields. (This is being used for rendering in the frontend)
|
||||
exports.send = ({ serviceName, newListings, notificationConfig, jobKey }) => {
|
||||
@@ -102,13 +100,14 @@ exports.config = {
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
```
|
||||
|
||||
#### Running Tests
|
||||
|
||||
If you've written a new provider you are an awesome person. If you now write tests for it, you are even more awesome. And who doesn't want to be more awesome, right?
|
||||
|
||||
#### Codestyle
|
||||
|
||||
I'm using ESLint to maintain quote style and quality. Do not skip it...
|
||||
|
||||
##### To-do before merging:
|
||||
|
||||
25
README.md
25
README.md
@@ -9,6 +9,7 @@ _Fredy_ scrapes multiple services (Immonet, Immowelt etc.) and send new listings
|
||||
If _Fredy_ finds matching results, it will send them to you via Slack, Email, Telegram etc. (More adapters can be configured.) As _Fredy_ stores the listings it has found, new results will not be sent to you twice (and as a side-effect, _Fredy_ can show some statistics). Furthermore, _Fredy_ checks duplicates per scraping so that the same listings are not being sent twice or more when posted on various platforms (which happens more often than one might think).
|
||||
|
||||
# Sponsorship [](https://github.com/sponsors/orangecoding)
|
||||
|
||||
If you like my work, consider becoming a sponsor. I'm not expecting anybody to pay for _Fredy_ or any other Open Source Project I'm maintaining, however keep in mind, I'm doing all of this in my spare time :) Thanks.
|
||||
|
||||
[](https://jb.gg/OpenSourceSupport)
|
||||
@@ -16,17 +17,20 @@ If you like my work, consider becoming a sponsor. I'm not expecting anybody to p
|
||||
_Fredy_ is supported by JetBrains under Open Source Support Program
|
||||
|
||||
## Demo
|
||||
|
||||
If you want to try out _Fredy_, you can access the demo version [here](https://fredy.orange-coding.net) 🤘
|
||||
|
||||
## Usage
|
||||
|
||||
- Make sure to use Node.js 20 or above
|
||||
- Run the following commands:
|
||||
|
||||
```ssh
|
||||
yarn
|
||||
yarn run start:backend
|
||||
yarn run start:frontend
|
||||
```
|
||||
|
||||
_Fredy_ will start with the default port, set to `9998`. You can access _Fredy_ by opening your browser at `http://localhost:9998`. The default login is `admin`, both for username and password. You should change the password as soon as possible when you plan to run Fredy on a server.
|
||||
|
||||
<p align="center">
|
||||
@@ -38,52 +42,68 @@ _Fredy_ will start with the default port, set to `9998`. You can access _Fredy_
|
||||
</p>
|
||||
|
||||
## Understanding the fundamentals
|
||||
|
||||
There are 3 important parts in Fredy, that you need to understand to leverage the full power of _Fredy_.
|
||||
|
||||
#### Provider
|
||||
|
||||
_Fredy_ supports multiple services. Immonet, Immowelt and Ebay are just a few examples. Those services are called providers within _Fredy_. When creating a new job, you can choose one or more providers.
|
||||
A provider contains the URL that points to the search results for the respective service. If you go to immonet.de and search for something, the displayed URL in the browser is what the provider needs to do its magic.
|
||||
**It is important that you order the search results by date, so that _Fredy_ always picks the latest results first!**
|
||||
|
||||
#### Adapter
|
||||
|
||||
_Fredy_ supports multiple adapters, such as Slack, SendGrid, Telegram etc. A search job can have as many adapters as supported by _Fredy_. Each adapter needs different configuration values, which you have to provide when using them. An adapter dictates how the frontend renders by telling the frontend what information it needs in order to send listings to the user.
|
||||
|
||||
#### Jobs
|
||||
|
||||
A Job wraps adapters and providers. _Fredy_ runs the configured jobs in a specific interval (can be configured in `/conf/config.json`).
|
||||
|
||||
## Creating your first job
|
||||
|
||||
To create your first job, click on the button "Create New Job" on the job table. The job creation dialog should be self-explanatory, however there is one important thing.
|
||||
When configuring providers, before copying the URL from your browser, make sure that you have sorted the results by date to make sure _Fredy_ always picks the latest results first.
|
||||
|
||||
## User management
|
||||
|
||||
As an administrator, you can create, edit and remove users from _Fredy_. Be careful, each job is connected to the user that has created the job. If you remove the user, their jobs will also be removed.
|
||||
|
||||
# Development
|
||||
|
||||
### Running Fredy in development mode
|
||||
|
||||
Start the backend with:
|
||||
|
||||
```shell
|
||||
yarn run start:backend:dev
|
||||
```
|
||||
|
||||
For the frontend, run:
|
||||
|
||||
```shell
|
||||
yarn run start:frontend:dev
|
||||
```
|
||||
|
||||
You should now be able to access _Fredy_ from your browser. Check your Terminal to see what port the frontend is running on.
|
||||
|
||||
### Running Tests
|
||||
|
||||
To run the tests, run
|
||||
|
||||
```shell
|
||||
yarn run test
|
||||
```
|
||||
|
||||
# Architecture
|
||||

|
||||
|
||||

|
||||
|
||||
### Immoscout
|
||||
|
||||
Immoscout has implemented advanced bot detection. In order to work around this, we are using a reversed engineered version of their mobile api. See [Immoscout Reverse Engineering Documentation](https://github.com/orangecoding/fredy/blob/master/reverse-engineered-immoscout.md)
|
||||
|
||||
# Analytics
|
||||
|
||||
Fredy is completely free (and will always remain free). However, it would be a huge help if you’d allow me to collect some analytical data.
|
||||
Before you freak out, let me explain...
|
||||
If you agree, Fredy will send a ping to my Mixpanel project each time it runs.
|
||||
@@ -91,6 +111,7 @@ The data includes: names of active adapters/providers, OS, architecture, Node ve
|
||||
**Thanks**🤘
|
||||
|
||||
# Docker
|
||||
|
||||
Use the Dockerfile in this repository to build an image.
|
||||
|
||||
Example: `docker build -t fredy/fredy /path/to/your/Dockerfile`
|
||||
@@ -114,6 +135,7 @@ Example: `docker create --name fredy -v /path/to/your/conf/:/conf -p 9998:9998 f
|
||||
You can browse the logs with `docker logs fredy -f`.
|
||||
|
||||
### 👐 Contributing
|
||||
|
||||
Thanks to all the people who already contributed!
|
||||
|
||||
<a href="https://github.com/orangecoding/fredy/graphs/contributors">
|
||||
@@ -122,7 +144,6 @@ Thanks to all the people who already contributed!
|
||||
|
||||
See [Contributing](https://github.com/orangecoding/fredy/blob/master/CONTRIBUTING.md)
|
||||
|
||||
|
||||
## Star History
|
||||
|
||||
[](https://www.star-history.com/#orangecoding/fredy&Date)
|
||||
|
||||
@@ -1 +1,7 @@
|
||||
{"interval":"60","port":9998,"workingHours":{"from":"","to":""},"demoMode":false,"analyticsEnabled":null}
|
||||
{
|
||||
"interval": "60",
|
||||
"port": 9998,
|
||||
"workingHours": { "from": "", "to": "" },
|
||||
"demoMode": false,
|
||||
"analyticsEnabled": null
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
version: '3.8'
|
||||
services:
|
||||
fredy:
|
||||
container_name: fredy
|
||||
|
||||
13
index.html
13
index.html
@@ -1,16 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8"
|
||||
<meta
|
||||
charset="UTF-8"
|
||||
name="viewport"
|
||||
content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<meta name="google" content="notranslate">
|
||||
content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1"
|
||||
/>
|
||||
<meta name="google" content="notranslate" />
|
||||
|
||||
<title>Fredy</title>
|
||||
</head>
|
||||
<body theme-mode="dark">
|
||||
|
||||
<div id="fredy" style="position: absolute;top: 0;left: 0;right: 0;bottom: 0;"></div>
|
||||
<div id="fredy" style="position: absolute; top: 0; left: 0; right: 0; bottom: 0"></div>
|
||||
</body>
|
||||
<script type="module" src="/ui/src/Index.jsx"></script>
|
||||
</html>
|
||||
@@ -26,7 +26,6 @@ loginRouter.post('/', async (req, res) => {
|
||||
return;
|
||||
}
|
||||
if (user.password === hasher.hash(password)) {
|
||||
|
||||
if (config.demoMode) {
|
||||
trackDemoAccessed();
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ const notificationAdapterList = fs.readdirSync('./lib//notification/adapter').fi
|
||||
const notificationAdapter = await Promise.all(
|
||||
notificationAdapterList.map(async (pro) => {
|
||||
return await import(`../../notification/adapter/${pro}`);
|
||||
})
|
||||
}),
|
||||
);
|
||||
notificationAdapterRouter.post('/try', async (req, res) => {
|
||||
const { id, fields } = req.body;
|
||||
|
||||
@@ -6,7 +6,7 @@ const providerList = fs.readdirSync('./lib/provider').filter((file) => file.ends
|
||||
const provider = await Promise.all(
|
||||
providerList.map(async (pro) => {
|
||||
return await import(`../../provider/${pro}`);
|
||||
})
|
||||
}),
|
||||
);
|
||||
providerRouter.get('/', async (req, res) => {
|
||||
res.body = provider.map((p) => p.metaInformation);
|
||||
|
||||
@@ -42,7 +42,6 @@ userRouter.delete('/', async (req, res) => {
|
||||
res.send();
|
||||
});
|
||||
userRouter.post('/', async (req, res) => {
|
||||
|
||||
if (config.demoMode) {
|
||||
res.send(new Error('In demo mode, it is not allowed to change or add user.'));
|
||||
return;
|
||||
@@ -60,7 +59,7 @@ userRouter.post('/', async (req, res) => {
|
||||
const allUser = userStorage.getUsers(false);
|
||||
if (!isAdmin && !checkIfAnyAdminAfterRemovingUser(userId, allUser)) {
|
||||
res.send(
|
||||
new Error('You cannot change the admin flag for this user as otherwise, there is no other user in the system')
|
||||
new Error('You cannot change the admin flag for this user as otherwise, there is no other user in the system'),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
export const DEFAULT_CONFIG = {
|
||||
'interval': '60',
|
||||
'port': 9998,
|
||||
'workingHours': {'from': '', 'to': ''},
|
||||
'demoMode': false,
|
||||
'analyticsEnabled': null
|
||||
interval: '60',
|
||||
port: 9998,
|
||||
workingHours: { from: '', to: '' },
|
||||
demoMode: false,
|
||||
analyticsEnabled: null,
|
||||
};
|
||||
@@ -57,7 +57,7 @@ export const config = {
|
||||
token: {
|
||||
type: 'text',
|
||||
label: 'API token',
|
||||
description: 'Your application\'s API token.',
|
||||
description: "Your application's API token.",
|
||||
},
|
||||
user: {
|
||||
type: 'text',
|
||||
@@ -67,7 +67,8 @@ export const config = {
|
||||
device: {
|
||||
type: 'text',
|
||||
label: 'Device name',
|
||||
description: 'The device name to send your notification to. Messages may be addressed to multiple specific devices by joining them with a comma.',
|
||||
description:
|
||||
'The device name to send your notification to. Messages may be addressed to multiple specific devices by joining them with a comma.',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
### SendGrid Adapter
|
||||
|
||||
|
||||
SendGrid is a free email service (free as in "you cannot send more than 100(Sendgrid) and 200(Mailjet) emails a day"), which is more than enough for Fredy.
|
||||
|
||||
To use [SendGrid](https://sendgrid.com/), you need to create an account. You'll need to decided from which email address you want Fredy to send from. E.g. if you use yourGmailAccount@gmail.com, you have to add this to sendgrid and verify it as well.
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
### Slack Adapter
|
||||
|
||||
|
||||
In order to use [Slack](https://slack.com), you need to create an account. When done, you need to create a new App in your workspace. Give it the permission `chat:write:bot` and `chat:write:user`.
|
||||
|
||||
Now you need to create a user token and a channel. Make sure the bot is installed to this channel.
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
### Sqlite Adapter
|
||||
|
||||
This adapter stores search results in a sqlite database located in db/listings.db. This file can be used for further analysis later on.
|
||||
|
||||
Fields are:
|
||||
|
||||
```
|
||||
['serviceName', 'jobKey', 'id', 'size', 'rooms', 'price', 'address', 'title', 'link', 'description']
|
||||
```
|
||||
@@ -28,11 +28,13 @@ export const send = ({ serviceName, newListings, notificationConfig, jobKey }) =
|
||||
const messageParagraphs = [];
|
||||
|
||||
messageParagraphs.push(`<i>${jobName}</i> (${serviceName}) found <b>${newListings.length}</b> new listings:`);
|
||||
messageParagraphs.push(...chunk.map(
|
||||
messageParagraphs.push(
|
||||
...chunk.map(
|
||||
(o) =>
|
||||
`<a href='${o.link}'><b>${shorten(o.title.replace(/\*/g, ''), 45).trim()}</b></a>\n` +
|
||||
[o.address, o.price, o.size].join(' | ')
|
||||
));
|
||||
[o.address, o.price, o.size].join(' | '),
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* This is to not break the rate limit. It is to only send 1 message per second
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
### Telegram Adapter
|
||||
|
||||
|
||||
For Telegram, you need to create a Bot. This is pretty easy. Open [this](https://telegram.me/BotFather) url on your smartphone and follow the instructions.
|
||||
|
||||
A telegram bot is not allowed to send messages directly to a user, you as a user need to first contact the bot to get a chatId.
|
||||
|
||||
@@ -73,7 +73,7 @@ function enrichTrackingObject(trackingObject) {
|
||||
nodeVersion,
|
||||
language,
|
||||
distinct_id,
|
||||
fredy_version: version
|
||||
fredy_version: version,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ function inDevMode(){
|
||||
function isOneOf(word, arr) {
|
||||
if (!arr || arr.length === 0 || word == null) return false;
|
||||
const lowerWord = word.toLowerCase();
|
||||
return arr.some(item => lowerWord.indexOf(item.toLowerCase()) !== -1);
|
||||
return arr.some((item) => lowerWord.indexOf(item.toLowerCase()) !== -1);
|
||||
}
|
||||
|
||||
function nullOrEmpty(val) {
|
||||
@@ -45,13 +45,11 @@ function buildHash(...inputs) {
|
||||
if (inputs == null) {
|
||||
return null;
|
||||
}
|
||||
const cleaned = inputs.filter(i => i != null && i.length > 0);
|
||||
const cleaned = inputs.filter((i) => i != null && i.length > 0);
|
||||
if (cleaned.length === 0) {
|
||||
return null;
|
||||
}
|
||||
return createHash('sha256')
|
||||
.update(cleaned.join(','))
|
||||
.digest('hex');
|
||||
return createHash('sha256').update(cleaned.join(',')).digest('hex');
|
||||
}
|
||||
|
||||
let config = {};
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
"start:frontend": "vite -m production",
|
||||
"start:frontend:dev": "vite",
|
||||
"build:frontend": "vite build",
|
||||
"format": "prettier --write lib/**/*.js ui/src/**/*.jsx test/**/*.js *.js",
|
||||
"format:check": "prettier --check lib/**/*.js ui/src/**/*.jsx test/**/*.js *.js",
|
||||
"format": "prettier --write .",
|
||||
"format:check": "prettier --check .",
|
||||
"test": "mocha --loader=esmock --timeout 3000000 test/**/*.test.js",
|
||||
"lint": "eslint index.js lib/**/*.js test/**/*.js ui/src/**/*.jsx",
|
||||
"lint": "eslint .",
|
||||
"lint:fix": "yarn lint --fix"
|
||||
},
|
||||
"type": "module",
|
||||
|
||||
@@ -23,21 +23,23 @@ These protections make it extremely difficult to reliably extract data from Immo
|
||||
To work around these limitations, we are in the progress of reverse-engineering Immoscout24's mobile API. The mobile applications need to communicate with Immoscout's servers to retrieve listing data, and these API endpoints typically have fewer anti-bot protections than the web interface.
|
||||
|
||||
The mobile API provides several key endpoints:
|
||||
|
||||
- Search total endpoint: Returns the total number of listings for a given query
|
||||
- Search list endpoint: Retrieves the actual listings with details
|
||||
- Expose endpoint: Returns detailed information about a specific listing
|
||||
|
||||
Challenges:
|
||||
|
||||
1. Identifying the necessary endpoints and parameters required to perform searches
|
||||
2. Mapping the mobile API parameters to their web counterparts to maintain compatibility with existing search URLs
|
||||
|
||||
|
||||
## Api Specs
|
||||
|
||||
#### Search for Listings
|
||||
|
||||
`GET /search/total?{search parameters}`
|
||||
*Returns the total number of listings for the given query.*
|
||||
_Returns the total number of listings for the given query._
|
||||
|
||||
```
|
||||
curl -H "User-Agent: ImmoScout24_1410_30_._" \
|
||||
-H "Accept: application/json" \
|
||||
@@ -47,14 +49,17 @@ curl -H "User-Agent: ImmoScout24_1410_30_._" \
|
||||
---
|
||||
|
||||
#### Retrieve the listings
|
||||
|
||||
`POST /search/list?{search parameters}`
|
||||
*The body is json encoded and contains data specifying additional results (advertisements) to return. The format is as follows (It is not necessary to provide data for the specified keys.)*
|
||||
_The body is json encoded and contains data specifying additional results (advertisements) to return. The format is as follows (It is not necessary to provide data for the specified keys.)_
|
||||
|
||||
```
|
||||
{
|
||||
"supportedResultListTypes": [],
|
||||
"userData": {}
|
||||
}
|
||||
```
|
||||
|
||||
```
|
||||
curl -X POST 'https://api.mobile.immobilienscout24.de/search/list?pricetype=calculatedtotalrent&realestatetype=apartmentrent&searchType=region&geocodes=%2Fde%2Fberlin%2Fberlin&pagenumber=1' \
|
||||
-H "Connection: keep-alive" \
|
||||
@@ -66,15 +71,18 @@ curl -X POST 'https://api.mobile.immobilienscout24.de/search/list?pricetype=calc
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### Get details of listings
|
||||
|
||||
`GET /expose/{id}`
|
||||
The response contains additional details not included in the listing response.
|
||||
|
||||
```
|
||||
curl -H "User-Agent: ImmoScout24_1410_30_._" \
|
||||
-H "Accept: application/json" \
|
||||
"https://api.mobile.immobilienscout24.de/expose/158382494"
|
||||
```
|
||||
|
||||
|
||||
## Parameters
|
||||
|
||||
The parameters between web and mobile are very different which is why we have to translate them. Please see [/lib/services/immoscout/immoscout-web-translator.js](https://github.com/orangecoding/fredy/blob/master/lib/services/immoscout/immoscout-web-translator.js).
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
background: #31303078 !important;
|
||||
}
|
||||
|
||||
.ui.black.label, .ui.black.labels .label {
|
||||
.ui.black.label,
|
||||
.ui.black.labels .label {
|
||||
background-color: #31303078 !important;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
body, html {
|
||||
body,
|
||||
html {
|
||||
margin: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
.logo {
|
||||
position: absolute;
|
||||
top: .1rem;
|
||||
top: 0.1rem;
|
||||
right: 2rem;
|
||||
}
|
||||
@@ -20,17 +20,16 @@
|
||||
border-radius: 360px;
|
||||
animation: pulse 1s infinite ease-in-out;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@keyframes pulse {
|
||||
0% {
|
||||
background-color: rgba(165, 165, 165, 0.1)
|
||||
background-color: rgba(165, 165, 165, 0.1);
|
||||
}
|
||||
50% {
|
||||
background-color: rgba(165, 165, 165, 0.3)
|
||||
background-color: rgba(165, 165, 165, 0.3);
|
||||
}
|
||||
100% {
|
||||
background-color: rgba(165, 165, 165, 0.1)
|
||||
background-color: rgba(165, 165, 165, 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,6 +129,6 @@ function parseJSON(response) {
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((error) => reject('Error while trying to parse json.', error))
|
||||
.catch((error) => reject('Error while trying to parse json.', error)),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -9,5 +9,4 @@
|
||||
font-size: 11px;
|
||||
margin-left: 1rem;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user