This project is not covered by Drupal’s security advisory policy.

The Migrate Process JS Redirect Link module provides a Migrate process plugin to enable to enable you to request and extract a link from a inter-linked JS enabled redirect page commonly found on Google RSS feeds.

Background

e.g. Google will give a link like this on your rss feed:

https://news.google.com/rss/articles/CBMiVWh0dHBzOi8vd3d3LmxvbmRvbi1maXJ...

This page will typically contain a js redirect to:

https://www.london-fire.gov.uk/incidents/2023/january/maisonette-fire-st...

This module enables you to import the second link that comes without the inter-linked google page and cookie consent form etc. It also allows for imported links to show your site as a referrer rather than directing everything through Google.

Example 1

process:
  title: title
  'field_feed_item_description/format':
    plugin: default_value
    default_value: full_html
  'field_feed_item_description/value': summary
  'field_web_link/uri':
   -
     plugin: migrate_process_js_link
     source: link
  'field_web_link/title': title

Example 2 (with migrate_process_html)

process:
  'body/value':
   -
     plugin: migrate_process_js_redirect_link
     source: link
   -
     plugin: migrate_process_html
     jsredirect: false // to be deprecated
   -
     plugin: dom
     method: import
   -
     plugin: dom_select
     selector: //meta[@property="og:image"]/@content
   -
     plugin: skip_on_empty
     method: row
     message: 'Field image is missing'
   -
     plugin: extract
     index:
       - 0
   -
     plugin: skip_on_condition
     method: row
     condition:
       plugin: not:matches
       regex: /^(https?:\/\/)[\w\d]/i
     message: 'We only want a string if it starts with http(s)://[\w\d]'
   -
     plugin: file_remote_url

Project information

Releases