├── requirements.txt ├── model.py ├── README.md ├── roam.py ├── export_books.py └── LICENSE /requirements.txt: -------------------------------------------------------------------------------- 1 | PyFunctional 2 | beautifulsoup4 3 | click 4 | requests 5 | dacite 6 | dateparser -------------------------------------------------------------------------------- /model.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | from datetime import date 3 | from enum import Enum 4 | 5 | from bs4 import BeautifulSoup 6 | from functional import seq 7 | 8 | from roam import roam_date 9 | 10 | 11 | class Color(Enum): 12 | """ 13 | Probably most hacky part of this. Logic is that the colors are represented by images with the given index 14 | """ 15 | BLUE = 1 16 | RED = 2 17 | YELLOW = 3 18 | GREEN = 4 19 | 20 | 21 | @dataclass 22 | class Highlight: 23 | book: str 24 | text: str 25 | note: str 26 | link: str 27 | page: str 28 | date: date 29 | color: Color 30 | 31 | @property 32 | def markdown_link(self): 33 | return f'[{self.book}: {self.page}]({self.link})' 34 | 35 | @property 36 | def color_attribute(self): 37 | return f'color::#{self.color.name.lower()}' 38 | 39 | @property 40 | def date_attribute(self): 41 | return f'date::[[{roam_date(self.date)}]]' 42 | 43 | def as_roam_block_hierarchy(self): 44 | return { 45 | self.text: ([{self.note: []}] if self.note else []) + [ 46 | {self.markdown_link: []}, 47 | {self.date_attribute: []}, 48 | {self.color_attribute: []}, 49 | ] 50 | } 51 | 52 | def as_roam_markdown(self): 53 | return seq( 54 | f' - {self.text}', 55 | f' - {self.note}' if self.note else None, 56 | f' - {self.markdown_link}', 57 | f' - {self.date_attribute}', 58 | f' - {self.color_attribute}' 59 | ).filter(lambda it: it is not None).make_string('\n') 60 | 61 | def as_anki_csv_row(self): 62 | soup = BeautifulSoup() 63 | link = soup.new_tag('a', href=self.link, string=f'{self.book}: {self.page}') 64 | 65 | return [self.text, self.note, link, str(self.date), self.color.name.lower()] 66 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Google Books highlights and notes extractor 2 | A script to extract highlights and notes from Google Books highlight document in Google Drive. 3 | 4 | **Why**. The highlights document is ok to read, but if you want to use the highlights/notes elsewhere, there is no way for you to do this besides manually copying notes one by one. 5 | My specific use case is adding them to RoamResearch or Anki. 6 | 7 | This script is going to extract: 8 | * Highlight 9 | * Note (if present) 10 | * Reference to the position in a book where the highlight originates from. 11 | * Date when the highlight was made. 12 | * Highlight color 13 | 14 | 15 | ### How to use this: 16 | 17 | 1. Go to the Google Document created by the Google Books with highlights for the book you're interested in; 18 | 1. Download it as HTML; 19 | 1. Uncompress the archive that you got on the previous step; 20 | 1. Install dependencies if any are missing (see requirements.txt) 21 | 1. Run parser.py with the HTML file you got after unpacking the archive as an input. E.g: 22 | * Markdown `python export_books.py local /path/to/file.html -o output.md -b "Book name" --since yesterday` 23 | * Roam Graph `python export_books.py roam /path/to/file.html -b "Book name" --since yesterday --graph stvad-api --api-key --graph-token ` 24 | 25 | 26 | #### Output formats 27 | 28 | This script supports the following output formats: 29 | 30 | 1. **Markdown** - store output to local Markdown file. Formatted to be pasted in Roam 31 | 1. **CSV** - store output to local CSV file. Structured in a way that it's easy to import into Anki 32 | 1. **Roam Graph** - this method uses Roam API to add highlights directly to the book's page in your Roam Graph (You'd need API token to use this) 33 | 34 | **Full options:** 35 | ``` 36 | Usage: export_books.py [OPTIONS] COMMAND [ARGS]... 37 | 38 | Options: 39 | --help Show this message and exit. 40 | 41 | Commands: 42 | local Output results locally 43 | roam Store highlights to a Roam Graph 44 | 45 | --- 46 | 47 | Usage: export_books.py local [OPTIONS] FILE 48 | 49 | Output results locally 50 | 51 | Options: 52 | -b, --book-name TEXT Book name, would be appended to the source 53 | reference [required] 54 | --since TEXT Starting point to take highlights from (supports 55 | natural language) 56 | -o, --output FILENAME Output file 57 | -t, --export-type [md|csv] 58 | --help Show this message and exit. 59 | 60 | --- 61 | 62 | Usage: export_books.py roam [OPTIONS] FILE 63 | 64 | Store highlights to a Roam Graph 65 | 66 | Options: 67 | -b, --book-name TEXT Book name, would be appended to the source reference 68 | [required] 69 | --since TEXT Starting point to take highlights from (supports 70 | natural language) 71 | -g, --graph TEXT The name of the Roam graph to store highlights to 72 | [required] 73 | --api-key TEXT Roam API key [required]. Also can be supplied through env variable ROAM_API_KEY 74 | --graph-token TEXT Roam Graph token [required]. Also can be supplied through env variable ROAM_GRAPH_TOKEN. 75 | --help Show this message and exit. 76 | ``` -------------------------------------------------------------------------------- /roam.py: -------------------------------------------------------------------------------- 1 | import json 2 | import logging as log 3 | from dataclasses import dataclass 4 | from datetime import date 5 | from typing import Optional, List 6 | 7 | import requests 8 | from dacite import from_dict 9 | from functional import seq 10 | 11 | log.basicConfig(level=log.INFO) 12 | 13 | 14 | @dataclass 15 | class Page: 16 | uid: str 17 | title: str 18 | 19 | @classmethod 20 | def from_pull_result(cls, result: dict): 21 | return cls(result['block/uid'], result['node/title']) 22 | 23 | 24 | @dataclass 25 | class Block: 26 | uid: str 27 | string: str 28 | 29 | @classmethod 30 | def from_pull_result(cls, result: dict): 31 | return Block(result['block/uid'], result['block/string']) 32 | 33 | @classmethod 34 | def from_create_result(cls, result: dict): 35 | return Block(result['uid'], result['string']) 36 | 37 | 38 | class RoamError(RuntimeError): 39 | object_exists = "cognitect.anomalies/conflict" 40 | 41 | def __init__(self, message, error_type=None): 42 | super().__init__(message) 43 | self.type = error_type 44 | 45 | 46 | def uid_param(uid): 47 | return [('uid', uid)] if uid else [] 48 | 49 | 50 | class Roam: 51 | def __init__(self, 52 | graph_name: str, 53 | key: str, 54 | token: str, 55 | endpoint: str = 'https://4c67k7zc26.execute-api.us-west-2.amazonaws.com/v1/alphaAPI'): 56 | self.graph_name = graph_name 57 | self.key = key 58 | self.token = token 59 | self.endpoint = endpoint 60 | 61 | def _send_request(self, action: str, **params): 62 | payload = dict([('graph-name', self.graph_name)], action=action, **params) 63 | log.info(f'Sending request to {self.endpoint}. For graph {self.graph_name} \n' 64 | f'With payload: {payload}') 65 | 66 | response = requests.post(self.endpoint, 67 | headers={ 68 | 'x-api-key': self.key, 69 | 'x-api-token': self.token, 70 | }, 71 | json=payload 72 | ) 73 | log.info(response) 74 | log.info(response.text) 75 | self.raise_errors(response) 76 | result = json.loads(response.text)['success'] 77 | return result 78 | 79 | def query(self, query: str) -> List: 80 | return seq(self._send_request('q', query=query)).map(lambda it: it[0]).to_list() 81 | 82 | def pull(self, selector, uid): 83 | return self._send_request('pull', selector=selector, uid=uid) 84 | 85 | def get_page_by_title(self, title: str) -> Page: 86 | result = self.query(f'[:find (pull ?page [*]) ' 87 | f':where [?page :node/title "{title}"]' 88 | f']') 89 | 90 | return Page.from_pull_result(result[0]) 91 | 92 | def get_children(self, uid): 93 | results = self.query('[:find (pull ?children [*])' 94 | ':where ' 95 | f'[?block :block/uid "{uid}"]' 96 | '[?block :block/children ?children]' 97 | ']') 98 | 99 | return [Block.from_pull_result(block) for block in results] 100 | 101 | def get_children_by_string(self, parent_uid: str, string: str): 102 | children = self.get_children(parent_uid) 103 | return seq(children).filter(lambda it: it.string == string).to_list() 104 | 105 | def get_all_blocks(self): 106 | return self.query('[ :find (pull ?block [:block/string :block/uid]) :where [?block :block/string]]') 107 | 108 | def create_page(self, title: str, uid: Optional[str] = None): 109 | result = self._send_request('create-page', 110 | page=dict([('title', title)] + uid_param(uid))) 111 | return from_dict(Page, result[0]) 112 | 113 | @staticmethod 114 | def raise_errors(response): 115 | error = json.loads(response.text).get('error') 116 | if error: 117 | raise RoamError(error['cognitect.anomalies/message'], 118 | error['cognitect.anomalies/category']) 119 | 120 | def create_block(self, parent_uid: str, block: dict, order: int = 0): 121 | # todo uid support? 122 | string = next(iter(block)) 123 | response = self._send_request('create-block', 124 | location={'parent-uid': parent_uid, 'order': order}, 125 | block={'string': string}) 126 | 127 | result = Block.from_create_result(response[0]) 128 | return result, {result.uid: [self.create_block(result.uid, child) for child in reversed(block[string])]} 129 | 130 | 131 | def strftime(date_format, date_to_format: date): 132 | def suffix(day): 133 | return 'th' if 11 <= day <= 13 else {1: 'st', 2: 'nd', 3: 'rd'}.get(day % 10, 'th') 134 | 135 | return date_to_format.strftime(date_format).replace('{S}', str(date_to_format.day) + suffix(date_to_format.day)) 136 | 137 | 138 | def roam_date(date_to_format: date): 139 | return strftime("%B {S}, %Y", date_to_format) 140 | -------------------------------------------------------------------------------- /export_books.py: -------------------------------------------------------------------------------- 1 | import csv 2 | import dateparser 3 | import functools 4 | import logging as log 5 | from datetime import datetime, date 6 | from sys import stdout 7 | from typing import IO, Iterable 8 | 9 | import click 10 | from bs4 import BeautifulSoup, Tag 11 | from functional import seq 12 | 13 | from model import Highlight, Color 14 | from roam import Roam, RoamError, Page, Block 15 | 16 | log.basicConfig(level=log.INFO) 17 | 18 | 19 | def save_md(file: IO, highlights: seq): 20 | file.write(highlights.map(lambda it: it.as_roam_markdown()).make_string('\n')) 21 | 22 | 23 | def save_csv(file, highlights: seq): 24 | writer = csv.writer(file) 25 | writer.writerows(highlights.map(lambda it: it.as_anki_csv_row())) 26 | 27 | 28 | save_map = {'md': save_md, 'csv': save_csv} 29 | 30 | 31 | @click.group() 32 | def cli(): 33 | pass 34 | 35 | 36 | def common_params(func): 37 | @click.argument('file', type=click.File()) 38 | @click.option('-b', '--book-name', required=True, help='Book name, would be appended to the source reference') 39 | @click.option('--since', default='0', help='Starting point to take highlights from (supports natural language)') 40 | @functools.wraps(func) 41 | def wrapper(*args, **kwargs): 42 | return func(*args, **kwargs) 43 | 44 | return wrapper 45 | 46 | 47 | @cli.command(help='Output results locally') 48 | @common_params 49 | @click.option('-o', '--output', default=stdout, help="Output file", type=click.File(mode="w")) 50 | @click.option('-t', '--export-type', default='md', type=click.Choice(save_map.keys())) 51 | def local(file, book_name, since, output, export_type): 52 | highlights = find_highlights(file, book_name, dateparser.parse(since).date()) 53 | 54 | save_map[export_type](output, highlights) 55 | 56 | 57 | @cli.command(help='Store highlights to a Roam Graph') 58 | @common_params 59 | @click.option('-g', '--graph', required=True, help='The name of the Roam graph to store highlights to') 60 | @click.option('--api-key', required=True, help='Roam API key', envvar='ROAM_API_KEY') 61 | @click.option('--graph-token', required=True, help='Roam Graph token', envvar='ROAM_GRAPH_TOKEN') 62 | def roam(file, book_name, since, graph, api_key, graph_token): 63 | highlights = find_highlights(file, book_name, dateparser.parse(since).date()) 64 | 65 | client = Roam(graph, api_key, graph_token) 66 | RoamSaver(client).save(book_name, highlights) 67 | 68 | 69 | class RoamSaver: 70 | def __init__(self, roam_client: Roam, 71 | header_block_name: str = '#highlights'): 72 | self.roam = roam_client 73 | self.header_block_name = header_block_name 74 | 75 | def save(self, book: str, highlights: Iterable[Highlight]): 76 | page = self.create_book_page(book) 77 | block = self.create_header_block(page) 78 | result = seq(highlights).map(lambda it: it.as_roam_block_hierarchy()).reverse().map( 79 | lambda it: self.roam.create_block(block.uid, it)) 80 | 81 | log.info(result) 82 | 83 | def create_book_page(self, book) -> Page: 84 | try: 85 | page = self.roam.create_page(book) 86 | # todo create metadata block 87 | return page 88 | except RoamError as e: 89 | if e.type == RoamError.object_exists: 90 | log.info(e) 91 | return self.roam.get_page_by_title(book) 92 | else: 93 | raise 94 | 95 | def create_header_block(self, page: Page) -> Block: 96 | children = self.roam.get_children_by_string(page.uid, self.header_block_name) 97 | 98 | if children: 99 | return children[0] 100 | 101 | return self.roam.create_block(page.uid, {self.header_block_name: []})[0] 102 | 103 | 104 | def find_highlights(file, book_name: str, since: date = date.min): 105 | """ 106 | The extraction is based on the structure of the HTML file the export from Google Docs would give you for the 107 | document containing the notes. 1 cell table container, inside of which there is another table that contains cells 108 | for Image, Highlight, Note and Date. 109 | """ 110 | soup = BeautifulSoup(file.read(), 'html.parser') 111 | containers = soup.find_all(rowspan=1, colspan=1) 112 | return (seq(containers) 113 | .map(lambda tag: tag.find_all(rowspan=1, colspan=1)) 114 | .filter(lambda quote_tags: len(quote_tags) != 0) 115 | .map(lambda tags: parse_highlight(*tags, book=book_name)) 116 | .filter(lambda it: it is not None) 117 | .filter(lambda it: it.date >= since)) 118 | 119 | 120 | def parse_color(color_container: Tag) -> Color: 121 | color_tag: Tag = color_container.find('img') 122 | 123 | name_color_map = {f'images/image{color.value}.png': color for color in Color} 124 | 125 | return name_color_map[color_tag['src']] 126 | 127 | 128 | def parse_highlight(color_container, quote, link, book): 129 | try: 130 | text, *note, date_tag = quote.find_all('span') 131 | link_tag: Tag = link.find('a') 132 | return Highlight(book, 133 | text.get_text(), 134 | extract_note(note), 135 | link_tag['href'], 136 | link_tag.string, 137 | datetime.strptime(date_tag.get_text(), "%B %d, %Y").date(), 138 | parse_color(color_container)) 139 | except Exception as e: 140 | print(quote, e) 141 | return None 142 | 143 | 144 | def extract_note(note_tags): 145 | try: 146 | _, note_tag, _ = note_tags 147 | return note_tag.get_text() 148 | except: 149 | return "" 150 | 151 | 152 | if __name__ == '__main__': 153 | cli() 154 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------