Extract data behind a login
FollowThe updated tutorial for the latest version 8.1 is available here. Go to have a check now!
When the target data is behind authentication, it is still possible to access the data with Octoparse. Simply text input the login information (username and password) then click on the "sign in" button to log in. In this tutorial, we will show you how to extract data behind a login, as well as how to use cookies to optimize the workflow of your task.
1) Enter login information to sign in
2) Use cookies to optimize the workflow
Enter login information to sign in
- Click on the textbox for username input on the web page
- Select "Enter text" from Action Tips
- Input the username into the textbox
- Click "OK", the username entered is automatically populated to the username textbox on the web page
- Follow the same steps to enter the password
- Click the "Sign In" button on the page
- From Action Tips, select "Click button"
Octoparse has now logged in the website successfully!
Use cookies to optimize the workflow
1. Save cookies
Most of the time, you can optimize the workflow by saving the cookie in the task after login. This way, Octoparse will send the saved cookie to the website at loading, and there's a good chance the website will remember "you" and skip the login steps.
- Log in the website in Octoparse's built-in browser if you have not already done so.
- Switch to the Workflow Mode by toggling the Workflow switch
on the top, drag a "Go To Web Page" action to the workflow, position right below the sign in steps.
- Enter the URL of the page needed for the capture into the text box for "Page URL"
- Under "Advanced Options", click open "Cache Settings"
- Select "Use specified Cookie"
- Click "Load cookie from current web page"
- Click "OK" to save the settings
- Now as the web page is supposed to "remember" the login and skip the login steps, we'll remove the previously created actions for the login to avoid running into issues when the workflow is executed. Right-click on the action and select "Delete".
Tips! 1. A saved cookie is only effective before it gets expired Cookies come in many different forms. Some have a specific expiration time, others expire immediately as the browser is closed. In Octoparse, the saved cookie will no longer work when it gets expired. To solve this, you will need to go through the log in steps once again by adding in the proper actions in order to obtain and save the updated cookie. 2. Your password is well-protected
|
2. Clear cookies
As all websites handle cookies differently, to ensure the task workflow will work consistently, you may want to start with the login steps every time the task is executed. To do this, you can clear any cookies saved before the login page is loaded. This way, the target website will always "forget" you and takes you to the login page on which you can enter all the login information.
- Click "Go to Web Page" action for the login page
- Select "Clear cache before opening the web page" within Cache Setting
Tips! Entering captcha manually while running local extraction
|
[Video version of this tutorial is available here]
日本語記事:ログインした後のデータ取得
Webスクレイピングについての記事は 公式サイトでも読むことができます。
Artículo en español: Extraer datos detrás de un inicio de sesión
También puede leer artículos de web scraping en el sitio web oficial.
Related articles:
From: https://www.octoparse.com/tutorial-7/extract-data-behind-a-login