Skip to content

Instantly share code, notes, and snippets.

@fukata fukata/transform.md
Last active Oct 15, 2018

Embed
What would you like to do?
WebScraper - transform機能

レシピ

recipe:
  - url: 'https://fukata.org'
    steps:
      - key: title
        dom: 'html > head > title'
        action: get_text
        transform:
          - translate:
              from: ja_JP
              to:
                - en_US
                - ch_ZH
      - key: date_str
        dom: '#publish_at'
        action: get_text
        transform:
          - regex:
              re: '/([0-9]{4})年([0-9]{1,2})月([0-9]{1,2})日/'
              output: '\1-\2-\3'

出力

{
  "title": "オリジナルタイトル",
  "title_en_US": "英語に翻訳されたもの",
  "title_ch_ZH": "中国語に翻訳されたもの",
  "date_str": "2018年10月15日",
  "date_str_regex": "2018-10-15",
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.